Remove the threads locking in the dispatchers destruction notification
authorEmmanuele Bassi <ebassi@openedhand.com>
Wed, 22 Aug 2007 10:12:15 +0000 (10:12 +0000)
committerEmmanuele Bassi <ebassi@openedhand.com>
Wed, 22 Aug 2007 10:12:15 +0000 (10:12 +0000)
The GLib main loop allows destroying sources while still in the dispatcher
function, so whether the Clutter threading lock is being held or not is
actually unpredictable by the library. This might be fixed in GLib, so we
just do what GTK+ does for the time being and wait.

See bug: http://bugzilla.gnome.org/show_bug.cgi?id=459555

clutter/clutter-main.c

index b56fe47..3bddfab 100644 (file)
@@ -549,13 +549,15 @@ clutter_threads_dispatch_free (gpointer data)
 {
   ClutterThreadsDispatch *dispatch = data;
 
-  clutter_threads_enter ();
-
+  /* XXX - we cannot hold the thread lock here because the main loop
+   * might destroy a source while still in the dispatcher function; so
+   * knowing whether the lock is being held or not is not known a priori.
+   *
+   * see bug: http://bugzilla.gnome.org/show_bug.cgi?id=459555
+   */
   if (dispatch->notify)
     dispatch->notify (dispatch->data);
 
-  clutter_threads_leave ();
-
   g_slice_free (ClutterThreadsDispatch, dispatch);
 }