From d5485786a471be135d6a2bdf86fb5c60fe81d62e Mon Sep 17 00:00:00 2001 From: Havard Graff Date: Mon, 21 Mar 2011 16:01:05 +0100 Subject: [PATCH] queue[2]: Make upstream events MT-safe --- plugins/elements/gstqueue.c | 5 ++++- plugins/elements/gstqueue2.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/plugins/elements/gstqueue.c b/plugins/elements/gstqueue.c index 6a21a3e744..8242559fce 100644 --- a/plugins/elements/gstqueue.c +++ b/plugins/elements/gstqueue.c @@ -1284,7 +1284,9 @@ static gboolean gst_queue_handle_src_event (GstPad * pad, GstEvent * event) { gboolean res = TRUE; - GstQueue *queue = GST_QUEUE (GST_PAD_PARENT (pad)); + GstQueue *queue = GST_QUEUE (gst_pad_get_parent (pad)); + if (G_UNLIKELY (queue == NULL)) + return FALSE; #ifndef GST_DISABLE_GST_DEBUG GST_CAT_DEBUG_OBJECT (queue_dataflow, queue, "got event %p (%d)", @@ -1293,6 +1295,7 @@ gst_queue_handle_src_event (GstPad * pad, GstEvent * event) res = gst_pad_push_event (queue->sinkpad, event); + gst_object_unref (queue); return res; } diff --git a/plugins/elements/gstqueue2.c b/plugins/elements/gstqueue2.c index 08ce4cb3f7..64b9afbb43 100644 --- a/plugins/elements/gstqueue2.c +++ b/plugins/elements/gstqueue2.c @@ -2364,7 +2364,9 @@ static gboolean gst_queue2_handle_src_event (GstPad * pad, GstEvent * event) { gboolean res = TRUE; - GstQueue2 *queue = GST_QUEUE2 (GST_PAD_PARENT (pad)); + GstQueue2 *queue = GST_QUEUE2 (gst_pad_get_parent (pad)); + if (G_UNLIKELY (queue == NULL)) + return FALSE; #ifndef GST_DISABLE_GST_DEBUG GST_CAT_DEBUG_OBJECT (queue_dataflow, queue, "got event %p (%s)", @@ -2415,6 +2417,7 @@ gst_queue2_handle_src_event (GstPad * pad, GstEvent * event) break; } + gst_object_unref (queue); return res; }