GNOME Bugzilla – Bug 314710
gst_buffer_create_sub doesn't copy the GST_BUFFER_FLAGS
Last modified: 2005-09-27 14:17:25 UTC
gst_buffer_create_sub doesn't copy the GST_BUFFER_FLAGS. In my case that causes a segfault since I try to modify a [readonly] buffer through a sub-buffer after having called gst_buffer_make_writable on it, but the function doesn't make a copy.
Created attachment 51462 [details] [review] Simple patch
Nice catch! And thanks for the patch. We had a discussion on IRC about this and came to the conclusion that just copying all flags of the parent buffer doesn't seem like the right thing to do, even if there is the possibility that GstBuffer subclasses add their own flags which then get lost when doing _create_sub(). I guess we'll deal with that when it becomes a problem, so I've just fixed the case at hand for now. 2005-09-27 Tim-Philipp Muller <tim at centricular dot net> * gst/gstbuffer.c: (gst_subbuffer_init): Set READONLY flag on subbuffers, so that gst_buffer_make_writable() works correctly in all circumstances (we could have just copied the parent buffer's readonly flag, but conceptually it seems cleaner to mark all subbuffers as read-only). (based on patch by Alessandro Decina, #314710). * check/gst/gstbuffer.c: (create_read_only_buffer), (test_make_writable), (test_subbuffer_make_writable), (gst_test_suite): Add some tests for gst_buffer_make_writable(). Cheers -Tim