From 80eb160e0f62350271f061daa5f289d9d4277cf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 7 Apr 2011 11:24:35 +0200 Subject: [PATCH] bus: Immediately drop messages after calling the sync handler if this is a synchronous bus Otherwise we might wait forever for the message to be popped from the queue if a sync handler returned GST_BUS_ASYNC. https://bugzilla.gnome.org/show_bug.cgi?id=647005 --- gst/gstbus.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/gst/gstbus.c b/gst/gstbus.c index c102fb9585..4135a15866 100644 --- a/gst/gstbus.c +++ b/gst/gstbus.c @@ -347,6 +347,11 @@ gst_bus_post (GstBus * bus, GstMessage * message) && handler != gst_bus_sync_signal_handler) gst_bus_sync_signal_handler (bus, message, NULL); + /* If this is a bus without async message delivery + * always drop the message */ + if (!bus->priv->poll) + reply = GST_BUS_DROP; + /* now see what we should do with the message */ switch (reply) { case GST_BUS_DROP: @@ -357,8 +362,7 @@ gst_bus_post (GstBus * bus, GstMessage * message) /* pass the message to the async queue, refcount passed in the queue */ GST_DEBUG_OBJECT (bus, "[msg %p] pushing on async queue", message); gst_atomic_queue_push (bus->queue, message); - if (bus->priv->poll) - gst_poll_write_control (bus->priv->poll); + gst_poll_write_control (bus->priv->poll); GST_DEBUG_OBJECT (bus, "[msg %p] pushed on async queue", message); break; @@ -380,8 +384,7 @@ gst_bus_post (GstBus * bus, GstMessage * message) g_mutex_lock (lock); gst_atomic_queue_push (bus->queue, message); - if (bus->priv->poll) - gst_poll_write_control (bus->priv->poll); + gst_poll_write_control (bus->priv->poll); /* now block till the message is freed */ g_cond_wait (cond, lock);