Make glib_init safe to call more than once

This will be needed to fix constructor order for non-GNU libc.

https://bugzilla.gnome.org/show_bug.cgi?id=756139
This commit is contained in:
Matthias Clasen 2015-10-06 19:43:38 -04:00
parent 46a20470fa
commit 342d329685

View File

@ -231,6 +231,13 @@ g_debug_init (void)
static void static void
glib_init (void) glib_init (void)
{ {
static gboolean glib_inited;
if (glib_inited)
return;
glib_inited = TRUE;
g_messages_prefixed_init (); g_messages_prefixed_init ();
g_debug_init (); g_debug_init ();
g_quark_init (); g_quark_init ();