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 358737 - _gst_event_copy sets the wrong parent_refcount on the child structure
_gst_event_copy sets the wrong parent_refcount on the child structure
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: Normal normal
: 0.10.11
Assigned To: Tim-Philipp Müller
GStreamer Maintainers
Depends on:
Reported: 2006-10-01 10:30 UTC by Alessandro Decina
Modified: 2006-10-02 08:37 UTC
See Also:
GNOME target: ---
GNOME version: ---

Fix (395 bytes, patch)
2006-10-01 10:31 UTC, Alessandro Decina
committed Details | Review
test case (1.06 KB, patch)
2006-10-01 12:49 UTC, Alessandro Decina
committed Details | Review

Description Alessandro Decina 2006-10-01 10:30:35 UTC
_gst_event_copy copies an event and its child structure. So the new event, the parent of the new structure, has refcount=1. _gst_event_copy then sets the parent_refcount of the new structure to the refcount of the original event, rather than the new copy.
Comment 1 Alessandro Decina 2006-10-01 10:31:32 UTC
Created attachment 73743 [details] [review]
Comment 2 Alessandro Decina 2006-10-01 12:49:12 UTC
Created attachment 73747 [details] [review]
test case

A test case that exposes the bug. Notice how the event is ref'fed two times. Without that, after the gst_mini_object_make_writable both the events would be writable.
Comment 3 Tim-Philipp Müller 2006-10-02 08:37:56 UTC
Thanks for the patch and the test case! Committed:

2006-10-02  Tim-Philipp Müller  <tim at centricular dot net>

        Patch by: Alessandro Decina  <alessandro at nnva org>

        * gst/gstevent.c: (_gst_event_copy):
          Fix gst_mini_object_make_writable() and gst_event_copy() for events
          with event structures by setting the parent refcount address of the
          copied structure to the address of the refcount member of the newly
          copied event rather than the address of the refcount member of the
          original event. Fixes #358737.

        * tests/check/gst/gstevent.c: (GST_START_TEST):
          Unit test for the above.