[gjs: 3/4] object: Use GjsContextPrivate::from_current_context() to get context



commit 510e19800aef6746524e98461c591ef0e02593b2
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Tue Sep 24 01:32:36 2019 +0200

    object: Use GjsContextPrivate::from_current_context() to get context
    
    It's just the same, but cleaner

 gi/object.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
---
diff --git a/gi/object.cpp b/gi/object.cpp
index 802e27f3..e23fceae 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -1135,9 +1135,8 @@ ObjectInstance::toggle_up(void)
     if (!wrapper_is_rooted()) {
         /* FIXME: thread the context through somehow. Maybe by looking up
          * the compartment that obj belongs to. */
-        GjsContext *context = gjs_context_get_current();
         debug_lifecycle("Rooting wrapper");
-        auto cx = static_cast<JSContext *>(gjs_context_get_native_context(context));
+        auto* cx = GjsContextPrivate::from_current_context()->context();
         switch_to_rooted(cx);
     }
 }


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