mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-15 22:01:27 +00:00
bin: When copying the sort iterator, also copy its internal queue
Otherwise both iterators share the same references, the second one usually resulting in a crash when being freed. https://bugzilla.gnome.org/show_bug.cgi?id=771649
This commit is contained in:
parent
b724894b27
commit
a195e47633
1 changed files with 12 additions and 2 deletions
14
gst/gstbin.c
14
gst/gstbin.c
|
@ -1945,6 +1945,16 @@ typedef struct _GstBinSortIterator
|
|||
gboolean dirty; /* we detected structure change */
|
||||
} GstBinSortIterator;
|
||||
|
||||
static void
|
||||
copy_to_queue (gpointer data, gpointer user_data)
|
||||
{
|
||||
GstElement *element = data;
|
||||
GQueue *queue = user_data;
|
||||
|
||||
gst_object_ref (element);
|
||||
g_queue_push_tail (queue, element);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_bin_sort_iterator_copy (const GstBinSortIterator * it,
|
||||
GstBinSortIterator * copy)
|
||||
|
@ -1952,8 +1962,8 @@ gst_bin_sort_iterator_copy (const GstBinSortIterator * it,
|
|||
GHashTableIter iter;
|
||||
gpointer key, value;
|
||||
|
||||
copy->queue = it->queue;
|
||||
g_queue_foreach (©->queue, (GFunc) gst_object_ref, NULL);
|
||||
g_queue_init (©->queue);
|
||||
g_queue_foreach (&it->queue, copy_to_queue, ©->queue);
|
||||
|
||||
copy->bin = gst_object_ref (it->bin);
|
||||
if (it->best)
|
||||
|
|
Loading…
Reference in a new issue