Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/GStreamer/gstreamer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKouhei Sutou <kou@clear-code.com>2016-09-19 17:04:55 +0300
committerSebastian Dröge <sebastian@centricular.com>2016-09-30 13:40:36 +0300
commita195e47633967ed09b61ab6f6e270ce9ad04cbb2 (patch)
tree3bcff7644a5d4161877aa025e6a05a2e6be96e1d
parentb724894b27e2956c01e8198892d8220e16ab2597 (diff)
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
-rw-r--r--gst/gstbin.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/gst/gstbin.c b/gst/gstbin.c
index 9601b8ebba..49769625be 100644
--- a/gst/gstbin.c
+++ b/gst/gstbin.c
@@ -1946,14 +1946,24 @@ typedef struct _GstBinSortIterator
} 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)
{
GHashTableIter iter;
gpointer key, value;
- copy->queue = it->queue;
- g_queue_foreach (&copy->queue, (GFunc) gst_object_ref, NULL);
+ g_queue_init (&copy->queue);
+ g_queue_foreach (&it->queue, copy_to_queue, &copy->queue);
copy->bin = gst_object_ref (it->bin);
if (it->best)