vl.c: Guard against GThread double-initialization
authorAndreas Färber <andreas.faerber@web.de>
Mon, 31 Oct 2011 18:14:56 +0000 (19:14 +0100)
committerAndreas Färber <andreas.faerber@web.de>
Tue, 1 Nov 2011 19:41:06 +0000 (20:41 +0100)
GThread-ERROR **: GThread system may only be initialized once.
aborting...

Making the g_thread_init() call in vl.c conditional resolves an abort on
Mac OS X, where coroutine-gthread.c seems to call it before vl.c.

Reported-by: Juan Pineda <juan@logician.com>
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Cc: Daniel P. Berrange <berrange@redhat.com>
vl.c

diff --git a/vl.c b/vl.c
index b56e0cb..624da0f 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -2185,7 +2185,9 @@ int main(int argc, char **argv, char **envp)
     error_set_progname(argv[0]);
 
     g_mem_set_vtable(&mem_trace);
-    g_thread_init(NULL);
+    if (!g_thread_supported()) {
+        g_thread_init(NULL);
+    }
 
     runstate_init();