From d0a808cdc87c60f3dea4ac8d458324fd9e458ae7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?G=C3=B6ran=20J=C3=B6nsson?= Date: Tue, 1 Jul 2014 12:22:56 +0200 Subject: [PATCH] pad: Don't unlock while iterating over all sticky events for removal Otherwise we might end up getting the event removed from elsewhere at the same time while we're unlocked for g_object_notify(). https://bugzilla.gnome.org/show_bug.cgi?id=732556 --- gst/gstpad.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/gst/gstpad.c b/gst/gstpad.c index 28170ac..97158a0 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -399,6 +399,7 @@ remove_events (GstPad * pad) { guint i, len; GArray *events; + gboolean notify = FALSE; events = pad->priv->events; @@ -409,19 +410,24 @@ remove_events (GstPad * pad) ev->event = NULL; - if (event && GST_EVENT_TYPE (event) == GST_EVENT_CAPS) { - GST_OBJECT_UNLOCK (pad); - - GST_DEBUG_OBJECT (pad, "notify caps"); - g_object_notify_by_pspec ((GObject *) pad, pspec_caps); + if (event && GST_EVENT_TYPE (event) == GST_EVENT_CAPS) + notify = TRUE; - GST_OBJECT_LOCK (pad); - } gst_event_unref (event); } + GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_PENDING_EVENTS); g_array_set_size (events, 0); pad->priv->events_cookie++; + + if (notify) { + GST_OBJECT_UNLOCK (pad); + + GST_DEBUG_OBJECT (pad, "notify caps"); + g_object_notify_by_pspec ((GObject *) pad, pspec_caps); + + GST_OBJECT_LOCK (pad); + } } /* should be called with object lock */ -- 2.7.4