Bug 662071-[Win32]-Don't init the Big Clutter Lock
authorChun-wei Fan <fanchunwei@src.gnome.org>
Mon, 24 Oct 2011 16:13:53 +0000 (00:13 +0800)
committerChun-wei Fan <fanchunwei@src.gnome.org>
Mon, 24 Oct 2011 16:13:53 +0000 (00:13 +0800)
Since the Windows GUI system is assuming multithreadedness, initializing
locks after entering the GUI portion on Windows is likely to cause
problems[1][2], which results many Clutter programs to crash due to
releasing resources that they did not own.

[1]: Multi-threaded use of GTK+ on Win32 in README.win32 of GTK+
     source package
[2]: Explanation of Windows GUI system regarding its multithreadness
     assumptions-
     http://mail.gnome.org/archives/gtk-list/2011-June/msg00005.html

clutter/clutter-main.c

index 7d4d815..ff34bb0 100644 (file)
@@ -215,11 +215,17 @@ clutter_threads_init_default (void)
 {
   g_mutex_init (&clutter_threads_mutex);
 
+#ifndef CLUTTER_WINDOWING_WIN32
+  /* we don't need nor want locking functions on Windows.here\r
+  * as Windows GUI system assumes multithreadedness\r
+  * see bug: https://bugzilla.gnome.org/show_bug.cgi?id=662071\r
+  */
   if (clutter_threads_lock == NULL)
     clutter_threads_lock = clutter_threads_impl_lock;
 
   if (clutter_threads_unlock == NULL)
     clutter_threads_unlock = clutter_threads_impl_unlock;
+#endif /* CLUTTER_WINDOWING_WIN32 */
 }
 
 #define ENVIRONMENT_GROUP       "Environment"