[gjs] gjs: Don't register the gi module until a context is created



commit 1dd3a58683db63dd2bcde97a97b44de4fea98eca
Author: Dan Winship <danw gnome org>
Date:   Wed Aug 10 11:44:29 2011 -0400

    gjs: Don't register the gi module until a context is created
    
    gi was moved into libgjs, but was still using
    GJS_REGISTER_NATIVE_MODULE(), which was causing gjs_define_gi_stuff()
    to be run before main(), which is bad for any number of reasons.
    
    (In particular, this broke log() in gnome-shell, because the gi
    initialization code caused the gjs logging framework to be initialized
    before gnome-shell got a chance to set GJS_DEBUG_TOPICS.)
    
    https://bugzilla.gnome.org/show_bug.cgi?id=656295

 gjs/context.c |    2 +-
 gjs/gi.c      |    7 -------
 2 files changed, 1 insertions(+), 8 deletions(-)
---
diff --git a/gjs/context.c b/gjs/context.c
index 8697fec..d931a3b 100644
--- a/gjs/context.c
+++ b/gjs/context.c
@@ -669,7 +669,7 @@ gjs_context_constructor (GType                  type,
     }
 
     if (!gjs_is_registered_native_module(js_context->context, NULL, "gi"))
-        gjs_register_native_module("gi", gjs_define_gi_stuff, 0);
+        gjs_register_native_module("gi", gjs_define_gi_stuff, GJS_NATIVE_SUPPLIES_MODULE_OBJ);
 
     /* For GjsDBus */
     g_irepository_prepend_search_path(PKGLIBDIR);
diff --git a/gjs/gi.c b/gjs/gi.c
index e807968..0e43122 100644
--- a/gjs/gi.c
+++ b/gjs/gi.c
@@ -37,10 +37,3 @@ gjs_define_gi_stuff(JSContext      *context,
 {
     return gjs_define_repo(context, module_obj, "gi");
 }
-
-/* GJS_NATIVE_SUPPLIES_MODULE_OBJ means we will define "gi" instead
- * of defining the stuff inside "gi" only.
- */
-GJS_REGISTER_NATIVE_MODULE_WITH_FLAGS("gi",
-                                      gjs_define_gi_stuff,
-                                      GJS_NATIVE_SUPPLIES_MODULE_OBJ)



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