After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 314710 - gst_buffer_create_sub doesn't copy the GST_BUFFER_FLAGS
gst_buffer_create_sub doesn't copy the GST_BUFFER_FLAGS
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: Normal normal
: 0.9.3
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2005-08-28 13:42 UTC by Alessandro Decina
Modified: 2005-09-27 14:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Simple patch (676 bytes, patch)
2005-08-28 13:45 UTC, Alessandro Decina
reviewed Details | Review

Description Alessandro Decina 2005-08-28 13:42:54 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.
Comment 1 Alessandro Decina 2005-08-28 13:45:31 UTC
Created attachment 51462 [details] [review]
Simple patch
Comment 2 Tim-Philipp Müller 2005-09-27 14:17:25 UTC
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