mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-28 20:51:13 +00:00
bin: Fix minor race when adding to a bin
This patch simply add a null check around a case where a child may have been unparented concurrently to the deep_add_remove operation. This was found by accident in the form of an "IS_GST_OBJECT" assertion, but had no other known side effect in that test.
This commit is contained in:
parent
83e0da2061
commit
80a76a4b4d
1 changed files with 9 additions and 5 deletions
14
gst/gstbin.c
14
gst/gstbin.c
|
@ -1122,11 +1122,15 @@ gst_bin_do_deep_add_remove (GstBin * bin, gint sig_id, const gchar * sig_name,
|
||||||
while ((e = g_queue_pop_head (&elements))) {
|
while ((e = g_queue_pop_head (&elements))) {
|
||||||
GstObject *parent = gst_object_get_parent (GST_OBJECT_CAST (e));
|
GstObject *parent = gst_object_get_parent (GST_OBJECT_CAST (e));
|
||||||
|
|
||||||
GST_LOG_OBJECT (bin, "calling %s for element %" GST_PTR_FORMAT
|
/* an element could have removed some of its internal elements
|
||||||
" in bin %" GST_PTR_FORMAT, sig_name, e, parent);
|
* meanwhile, so protect against that */
|
||||||
g_signal_emit (bin, sig_id, 0, parent, e);
|
if (parent) {
|
||||||
gst_object_unref (parent);
|
GST_LOG_OBJECT (bin, "calling %s for element %" GST_PTR_FORMAT
|
||||||
g_object_unref (e);
|
" in bin %" GST_PTR_FORMAT, sig_name, e, parent);
|
||||||
|
g_signal_emit (bin, sig_id, 0, parent, e);
|
||||||
|
gst_object_unref (parent);
|
||||||
|
g_object_unref (e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gst_iterator_free (it);
|
gst_iterator_free (it);
|
||||||
|
|
Loading…
Reference in a new issue