summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVivia Nikolaidou <vivia@ahiru.eu>2015-03-13 15:28:42 +0200
committerSebastian Dröge <sebastian@centricular.com>2015-03-13 13:37:49 +0000
commit721539dc4f029afff5b40b35b42b48874f025f64 (patch)
tree03cc68e0c77f78c98150b6cd8b44ed4471f89dbf
parent6ec3c4bc66cbbefa6e5811874d9787d675c807ee (diff)
bus: Unreferencing messages outside the lock
Shouldn't take the lock while unreferencing messages, because that may cause more messages to be sent, which will try to take the lock and cause the app to hang. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=728777
-rw-r--r--gst/gstbus.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/gst/gstbus.c b/gst/gstbus.c
index 13b05462a..9953210bc 100644
--- a/gst/gstbus.c
+++ b/gst/gstbus.c
@@ -446,6 +446,7 @@ void
gst_bus_set_flushing (GstBus * bus, gboolean flushing)
{
GstMessage *message;
+ GList *l, *message_list = NULL;
GST_OBJECT_LOCK (bus);
@@ -455,13 +456,19 @@ gst_bus_set_flushing (GstBus * bus, gboolean flushing)
GST_DEBUG_OBJECT (bus, "set bus flushing");
while ((message = gst_bus_pop (bus)))
- gst_message_unref (message);
+ message_list = g_list_prepend (message_list, message);
} else {
GST_DEBUG_OBJECT (bus, "unset bus flushing");
GST_OBJECT_FLAG_UNSET (bus, GST_BUS_FLUSHING);
}
GST_OBJECT_UNLOCK (bus);
+
+ for (l = message_list; l; l = l->next) {
+ message = GST_MESSAGE (l);
+ gst_message_unref (message);
+ }
+ g_list_free (message_list);
}
/**