[gjs: 1/4] gjs: Ensure that GjsContextPrivate::from_current_context is not inlined



commit 609c5fd7b5966047fbc9d14b13227369c8dcf0ba
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Tue Sep 24 01:00:54 2019 +0200

    gjs: Ensure that GjsContextPrivate::from_current_context is not inlined
    
    Since this symbol uses symbols that are not inlined, if this is used
    inlined the linker might complain issues to from_object method,
    not making clear what the real error is.
    
    So just add a definition for this symbol so that it can't be inlined

 gjs/context-private.h | 4 +---
 gjs/context.cpp       | 4 ++++
 2 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/gjs/context-private.h b/gjs/context-private.h
index d73b627f..68dfb4f7 100644
--- a/gjs/context-private.h
+++ b/gjs/context-private.h
@@ -140,9 +140,7 @@ class GjsContextPrivate {
     }
     GJS_USE static GjsContextPrivate* from_object(GObject* public_context);
     GJS_USE static GjsContextPrivate* from_object(GjsContext* public_context);
-    GJS_USE static GjsContextPrivate* from_current_context(void) {
-        return from_object(gjs_context_get_current());
-    }
+    GJS_USE static GjsContextPrivate* from_current_context();
 
     GjsContextPrivate(JSContext* cx, GjsContext* public_context);
     ~GjsContextPrivate(void);
diff --git a/gjs/context.cpp b/gjs/context.cpp
index ae06ed39..25bdac75 100644
--- a/gjs/context.cpp
+++ b/gjs/context.cpp
@@ -121,6 +121,10 @@ GjsContextPrivate* GjsContextPrivate::from_object(GjsContext* js_context) {
         gjs_context_get_instance_private(js_context));
 }
 
+GjsContextPrivate* GjsContextPrivate::from_current_context() {
+    return from_object(gjs_context_get_current());
+}
+
 enum {
     PROP_0,
     PROP_SEARCH_PATH,


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