[glib] Make glib_init safe to call more than once



commit 342d3296851dfabd88e9e3909ab45fa16e8139e0
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Oct 6 19:43:38 2015 -0400

    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 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/glib/glib-init.c b/glib/glib-init.c
index e7002e6..405e2ad 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 ();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]