wtay gstreamer: gstreamer/ gstreamer/gst/

[email protected] Mon, 5 Jan 2009 07:41:15 -0800 (PST)
Newsgroups gmane.comp.video.gstreamer.cvs
Message-ID <[email protected]>
CVS Root:       /cvs/gstreamer
Module:         gstreamer
Changes by:     wtay
Date:           Mon Jan 05 2009  15:41:15 UTC

Log message:
* gst/gstbus.c: (gst_bus_wakeup_main_context):
The lock order should be maincontext > OBJECT_LOCK so we need to release
the object lock when waking up the mainloop to avoid deadlocks.

Modified files:
    .               : ChangeLog
    gst             : gstbus.c

Links:
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/ChangeLog.diff?r1=1.4212&r2=1.4213
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/gst/gstbus.c.diff?r1=1.69&r2=1.70

====Begin Diffs====
Index: ChangeLog
===================================================================
RCS file: /cvs/gstreamer/gstreamer/ChangeLog,v
retrieving revision 1.4212
retrieving revision 1.4213
diff -u -d -r1.4212 -r1.4213
--- ChangeLog	5 Jan 2009 10:14:27 -0000	1.4212
+++ ChangeLog	5 Jan 2009 15:40:58 -0000	1.4213
@@ -1,5 +1,11 @@
 2009-01-05  Wim Taymans  <[email protected]>
 
+	* gst/gstbus.c: (gst_bus_wakeup_main_context):
+	The lock order should be maincontext > OBJECT_LOCK so we need to release
+	the object lock when waking up the mainloop to avoid deadlocks.
+
+2009-01-05  Wim Taymans  <[email protected]>
 	* gst/gstbin.c: (gst_bin_set_index_func), (gst_bin_set_clock_func),
 	(gst_bin_change_state_func):
 	Use an iterator to set the clock and the index so that we can release
Index: gstbus.c
RCS file: /cvs/gstreamer/gstreamer/gst/gstbus.c,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- gstbus.c	27 Dec 2008 17:41:11 -0000	1.69
+++ gstbus.c	5 Jan 2009 15:41:00 -0000	1.70
@@ -298,9 +298,17 @@
 static void
 gst_bus_wakeup_main_context (GstBus * bus)
 {
+  GMainContext *ctx;
   GST_OBJECT_LOCK (bus);
-  g_main_context_wakeup (bus->priv->main_context);
+  if ((ctx = bus->priv->main_context))
+    g_main_context_ref (ctx);
   GST_OBJECT_UNLOCK (bus);
+  g_main_context_wakeup (ctx);
+  if (ctx)
+    g_main_context_unref (ctx);
 }

------------------------------------------------------------------------------