mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 16:50:47 +00:00
gst/gstevent.c: Fix gst_mini_object_make_writable() and gst_event_copy() for events with event structures by setting ...
Original commit message from CVS: 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.
This commit is contained in:
parent
6d3d058444
commit
86a6abe32d
3 changed files with 41 additions and 1 deletions
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
|||
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.
|
||||
|
||||
2006-09-29 Stefan Kost <ensonic@users.sf.net>
|
||||
|
||||
* docs/design/Makefile.am:
|
||||
|
|
|
@ -269,7 +269,7 @@ _gst_event_copy (GstEvent * event)
|
|||
if (event->structure) {
|
||||
copy->structure = gst_structure_copy (event->structure);
|
||||
gst_structure_set_parent_refcount (copy->structure,
|
||||
&event->mini_object.refcount);
|
||||
©->mini_object.refcount);
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
|
|
|
@ -217,6 +217,32 @@ GST_START_TEST (create_custom_events)
|
|||
/* The structure should have been duplicated */
|
||||
fail_if (gst_event_get_structure (event) ==
|
||||
gst_event_get_structure (event2));
|
||||
|
||||
gst_event_unref (event);
|
||||
gst_event_unref (event2);
|
||||
}
|
||||
|
||||
/* Make events writable */
|
||||
{
|
||||
structure = gst_structure_empty_new ("application/x-custom");
|
||||
fail_if (structure == NULL);
|
||||
event = gst_event_new_custom (GST_EVENT_CUSTOM_BOTH, structure);
|
||||
/* ref the event so that it becomes non-writable */
|
||||
gst_event_ref (event);
|
||||
gst_event_ref (event);
|
||||
/* this should fail if the structure isn't writable */
|
||||
ASSERT_CRITICAL (gst_structure_remove_all_fields ((GstStructure *)
|
||||
gst_event_get_structure (event)));
|
||||
|
||||
/* now make writable */
|
||||
event2 =
|
||||
GST_EVENT (gst_mini_object_make_writable (GST_MINI_OBJECT (event)));
|
||||
fail_unless (event != event2);
|
||||
/* this fail if the structure isn't writable */
|
||||
gst_structure_remove_all_fields ((GstStructure *)
|
||||
gst_event_get_structure (event2));
|
||||
|
||||
gst_event_unref (event);
|
||||
gst_event_unref (event);
|
||||
gst_event_unref (event2);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue