[gjs: 1/6] jsapi-util-root: Shorter way to get pointer to current context



commit b727beae872180693fd2f4027343abac818a8035
Author: Philip Chimento <philip chimento gmail com>
Date:   Tue Jul 16 23:06:33 2019 -0700

    jsapi-util-root: Shorter way to get pointer to current context

 gjs/jsapi-util-root.h | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
---
diff --git a/gjs/jsapi-util-root.h b/gjs/jsapi-util-root.h
index e5754198..024bd5b5 100644
--- a/gjs/jsapi-util-root.h
+++ b/gjs/jsapi-util-root.h
@@ -130,10 +130,9 @@ class GjsMaybeOwned {
             , m_func(func)
             , m_data(data)
         {
-            GjsContextPrivate* gjs = GjsContextPrivate::from_current_context();
-            g_assert(GJS_IS_CONTEXT(gjs->public_context()));
-            g_object_weak_ref(G_OBJECT(gjs->public_context()),
-                              on_context_destroy, this);
+            GjsContext* current = gjs_context_get_current();
+            g_assert(GJS_IS_CONTEXT(current));
+            g_object_weak_ref(G_OBJECT(current), on_context_destroy, this);
         }
 
         ~Notifier() { disconnect(); }
@@ -150,10 +149,9 @@ class GjsMaybeOwned {
             if (!m_parent)
                 return;
 
-            GjsContextPrivate* gjs = GjsContextPrivate::from_current_context();
-            g_assert(GJS_IS_CONTEXT(gjs->public_context()));
-            g_object_weak_unref(G_OBJECT(gjs->public_context()), on_context_destroy,
-                                this);
+            GjsContext* current = gjs_context_get_current();
+            g_assert(GJS_IS_CONTEXT(current));
+            g_object_weak_unref(G_OBJECT(current), on_context_destroy, this);
             m_parent = nullptr;
         }
 


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