[gjs] Fix mis-paired calls to JS_AddRoot/JS_RemoveRoot



commit a0259a2fe7a3cd87b9ab25d7cba312dcf5654067
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Thu Dec 9 17:59:07 2010 -0500

    Fix mis-paired calls to JS_AddRoot/JS_RemoveRoot
    
    Fix a case where we would never remove a root we added and another
    place where we removed a root twice in a cleanup path.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=636928

 modules/dbus-exports.c |    2 --
 modules/dbus.c         |    2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/modules/dbus-exports.c b/modules/dbus-exports.c
index ce79c7e..aa52ace 100644
--- a/modules/dbus-exports.c
+++ b/modules/dbus-exports.c
@@ -331,8 +331,6 @@ invoke_js_from_dbus(JSContext   *context,
         gjs_debug(GJS_DEBUG_DBUS,
                   "dbus method invocation failed");
 
-        JS_RemoveValueRoot(context, &rval);
-
         if (!dbus_reply_from_exception(context, method_call, &reply))
             gjs_debug(GJS_DEBUG_DBUS,
                       "dbus method invocation failed but no exception was set?");
diff --git a/modules/dbus.c b/modules/dbus.c
index d422e68..cfbd884 100644
--- a/modules/dbus.c
+++ b/modules/dbus.c
@@ -1039,6 +1039,8 @@ gjs_js_dbus_call(JSContext  *context,
     if (reply)
         dbus_message_unref(reply);
 
+    JS_RemoveValueRoot(context, &retval);
+
     return result;
 }
 



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