mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-03 17:22:29 +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;
|
||||
GESTimelineElement *owner;
|
||||
gulong handler_id;
|
||||
GESTimelineElement *self;
|
||||
} ChildPropHandler;
|
||||
|
||||
struct _GESTimelineElementPrivate
|
||||
|
@ -354,6 +355,9 @@ _child_prop_handler_free (ChildPropHandler * handler)
|
|||
if (handler->handler_id)
|
||||
g_signal_handler_disconnect (handler->child, handler->handler_id);
|
||||
g_object_thaw_notify (handler->child);
|
||||
|
||||
if (handler->child != (GObject *) handler->self &&
|
||||
handler->child != (GObject *) handler->owner)
|
||||
gst_object_unref (handler->child);
|
||||
g_slice_free (ChildPropHandler, handler);
|
||||
}
|
||||
|
@ -821,6 +825,10 @@ ges_timeline_element_add_child_property_full (GESTimelineElement * self,
|
|||
|
||||
signame = g_strconcat ("notify::", pspec->name, NULL);
|
||||
handler = (ChildPropHandler *) g_slice_new0 (ChildPropHandler);
|
||||
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->handler_id =
|
||||
|
|
Loading…
Reference in a new issue