From 342d3296851dfabd88e9e3909ab45fa16e8139e0 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 6 Oct 2015 19:43:38 -0400 Subject: [PATCH] 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 --- glib/glib-init.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/glib/glib-init.c b/glib/glib-init.c index e7002e65c..405e2ad69 100644 --- a/glib/glib-init.c +++ b/glib/glib-init.c @@ -231,6 +231,13 @@ g_debug_init (void) static void glib_init (void) { + static gboolean glib_inited; + + if (glib_inited) + return; + + glib_inited = TRUE; + g_messages_prefixed_init (); g_debug_init (); g_quark_init ();