Call InitializeCriticalSection() on the sdt_mutex in
authorTor Lillqvist <tml@novell.com>
Thu, 28 Dec 2006 17:55:06 +0000 (17:55 +0000)
committerTor Lillqvist <tml@src.gnome.org>
Thu, 28 Dec 2006 17:55:06 +0000 (17:55 +0000)
2006-12-28  Tor Lillqvist  <tml@novell.com>

* glib/gslice.c: Call InitializeCriticalSection() on the
sdt_mutex in g_slice_init_nomessage() and not in
_g_slice_thread_init_nomessage(), which is called only through
g_thread_init(). Not all programs call g_thread_init().

glib/gslice.c

index daebe35..f02ba8c 100644 (file)
@@ -359,6 +359,10 @@ g_slice_init_nomessage (void)
   /* at this point, g_mem_gc_friendly() should be initialized, this
    * should have been accomplished by the above g_malloc/g_new calls
    */
   /* at this point, g_mem_gc_friendly() should be initialized, this
    * should have been accomplished by the above g_malloc/g_new calls
    */
+#ifdef G_OS_WIN32
+  if (allocator->config.debug_blocks)
+    InitializeCriticalSection (&sdt_mutex);
+#endif
 }
 
 static inline guint
 }
 
 static inline guint
@@ -396,12 +400,7 @@ _g_slice_thread_init_nomessage (void)
   allocator->magazine_mutex = g_mutex_new();
   allocator->slab_mutex = g_mutex_new();
   if (allocator->config.debug_blocks)
   allocator->magazine_mutex = g_mutex_new();
   allocator->slab_mutex = g_mutex_new();
   if (allocator->config.debug_blocks)
-    {
-      smc_tree_mutex = g_mutex_new();
-#ifdef G_OS_WIN32
-      InitializeCriticalSection (&sdt_mutex);
-#endif
-    }
+    smc_tree_mutex = g_mutex_new();
 }
 
 static inline void
 }
 
 static inline void