[gjs: 5/6] context: use GjsAutoUnref to temporary keep a reference



commit 17332c73c10d8df34f75b1f91eb5757299d3aeb7
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Sun Oct 14 05:17:32 2018 +0200

    context: use GjsAutoUnref to temporary keep a reference

 gjs/context.cpp | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
---
diff --git a/gjs/context.cpp b/gjs/context.cpp
index ab16ad1e..1af42788 100644
--- a/gjs/context.cpp
+++ b/gjs/context.cpp
@@ -918,8 +918,7 @@ gjs_context_eval(GjsContext   *js_context,
 
     JSAutoCompartment ac(js_context->context, js_context->global);
     JSAutoRequest ar(js_context->context);
-
-    g_object_ref(G_OBJECT(js_context));
+    GjsAutoUnref<GjsContext> ctx(js_context, GjsAutoTakeOwnership());
 
     if (auto_profile)
         gjs_profiler_start(js_context->profiler);
@@ -982,7 +981,6 @@ gjs_context_eval(GjsContext   *js_context,
     ret = true;
 
  out:
-    g_object_unref(G_OBJECT(js_context));
     context_reset_exit(js_context);
     return ret;
 }


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