GNOME Bugzilla – Bug 358737
_gst_event_copy sets the wrong parent_refcount on the child structure
Last modified: 2006-10-02 08:37:56 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.
Created attachment 73743 [details] [review] Fix
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.
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.