mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-05 10:12:20 +00:00
element: Handle using own property as child property
Avoiding ref cycles
This commit is contained in:
parent
7f0fc6fbed
commit
66fb647183
1 changed files with 10 additions and 2 deletions
|
@ -134,6 +134,7 @@ typedef struct
|
||||||
GObject *child;
|
GObject *child;
|
||||||
GESTimelineElement *owner;
|
GESTimelineElement *owner;
|
||||||
gulong handler_id;
|
gulong handler_id;
|
||||||
|
GESTimelineElement *self;
|
||||||
} ChildPropHandler;
|
} ChildPropHandler;
|
||||||
|
|
||||||
struct _GESTimelineElementPrivate
|
struct _GESTimelineElementPrivate
|
||||||
|
@ -354,7 +355,10 @@ _child_prop_handler_free (ChildPropHandler * handler)
|
||||||
if (handler->handler_id)
|
if (handler->handler_id)
|
||||||
g_signal_handler_disconnect (handler->child, handler->handler_id);
|
g_signal_handler_disconnect (handler->child, handler->handler_id);
|
||||||
g_object_thaw_notify (handler->child);
|
g_object_thaw_notify (handler->child);
|
||||||
gst_object_unref (handler->child);
|
|
||||||
|
if (handler->child != (GObject *) handler->self &&
|
||||||
|
handler->child != (GObject *) handler->owner)
|
||||||
|
gst_object_unref (handler->child);
|
||||||
g_slice_free (ChildPropHandler, handler);
|
g_slice_free (ChildPropHandler, handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -821,7 +825,11 @@ ges_timeline_element_add_child_property_full (GESTimelineElement * self,
|
||||||
|
|
||||||
signame = g_strconcat ("notify::", pspec->name, NULL);
|
signame = g_strconcat ("notify::", pspec->name, NULL);
|
||||||
handler = (ChildPropHandler *) g_slice_new0 (ChildPropHandler);
|
handler = (ChildPropHandler *) g_slice_new0 (ChildPropHandler);
|
||||||
handler->child = gst_object_ref (child);
|
handler->self = self;
|
||||||
|
if (child == G_OBJECT (self) || child == G_OBJECT (owner))
|
||||||
|
handler->child = child;
|
||||||
|
else
|
||||||
|
handler->child = gst_object_ref (child);
|
||||||
handler->owner = owner;
|
handler->owner = owner;
|
||||||
handler->handler_id =
|
handler->handler_id =
|
||||||
g_signal_connect (child, signame, G_CALLBACK (child_prop_changed_cb),
|
g_signal_connect (child, signame, G_CALLBACK (child_prop_changed_cb),
|
||||||
|
|
Loading…
Reference in a new issue