From b5e5d38ce78f11b495473533aca179d77850c1e5 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Thu, 28 Dec 2006 17:55:06 +0000 Subject: [PATCH] Call InitializeCriticalSection() on the sdt_mutex in 2006-12-28 Tor Lillqvist * 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 | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/glib/gslice.c b/glib/gslice.c index daebe355b..f02ba8cc8 100644 --- a/glib/gslice.c +++ b/glib/gslice.c @@ -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 */ +#ifdef G_OS_WIN32 + if (allocator->config.debug_blocks) + InitializeCriticalSection (&sdt_mutex); +#endif } 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) - { - smc_tree_mutex = g_mutex_new(); -#ifdef G_OS_WIN32 - InitializeCriticalSection (&sdt_mutex); -#endif - } + smc_tree_mutex = g_mutex_new(); } static inline void