ges-timeline-element: Fix refcount bug in "timeline" and "parent" properties

ges-timeline-element property getter handler was using
g_value_take_object() with internal pointers of the element as
arguments, instead of g_value_set_object().

g_value_take_object() moves the ownership of the reference; hence,
when reading "timeline" the reference ownership of timeline is moved
away from the ges-timeline-element and into the GValue.

Since GValues are temporaries that are often discarded quickly after,
this can easily lead to a double free. This was causing
gst-editing-services / pythontests to crash when running
TestTrackElements.test_ungroup_regroup() because of an innocent read of
`clip2.props.timeline` around the end of the test.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4924>
This commit is contained in:
Alicia Boya García 2023-06-23 12:29:04 +02:00 committed by GStreamer Marge Bot
parent fd25e24217
commit 64b4257509

View file

@ -295,10 +295,10 @@ _get_property (GObject * object, guint property_id,
switch (property_id) {
case PROP_PARENT:
g_value_take_object (value, self->parent);
g_value_set_object (value, self->parent);
break;
case PROP_TIMELINE:
g_value_take_object (value, self->timeline);
g_value_set_object (value, self->timeline);
break;
case PROP_START:
g_value_set_uint64 (value, self->start);