[gjs] gerror: Root define_error_properties()



commit 0ce5445679e2b5ae570fa28d3f30805cbe285351
Author: Philip Chimento <philip chimento gmail com>
Date:   Tue Jan 10 19:07:22 2017 -0800

    gerror: Root define_error_properties()
    
    This function now requires a rooted object, since the
    JS_DefinePropertyById() calls require one as well.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=776966

 gi/gerror.cpp |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/gi/gerror.cpp b/gi/gerror.cpp
index bf07e3b..6ae2207 100644
--- a/gi/gerror.cpp
+++ b/gi/gerror.cpp
@@ -44,7 +44,7 @@ typedef struct {
 
 extern struct JSClass gjs_error_class;
 
-static void define_error_properties(JSContext *, JSObject *);
+static void define_error_properties(JSContext *, JS::HandleObject);
 
 GJS_DEFINE_PRIV_FROM_JS(Error, gjs_error_class)
 
@@ -397,8 +397,8 @@ find_error_domain_info(GQuark domain)
    fileName, lineNumber and stack
 */
 static void
-define_error_properties(JSContext *context,
-                        JSObject  *obj)
+define_error_properties(JSContext       *context,
+                        JS::HandleObject obj)
 {
     JS::RootedValue stack(context), fileName(context), lineNumber(context);
     /* COMPAT: mozilla::Maybe gains a much more usable API in future versions */
@@ -432,7 +432,6 @@ gjs_error_from_gerror(JSContext             *context,
                       GError                *gerror,
                       bool                   add_stack)
 {
-    JSObject *obj;
     Error *priv;
     Error *proto_priv;
     GIEnumInfo *info;
@@ -463,7 +462,8 @@ gjs_error_from_gerror(JSContext             *context,
     JS::RootedObject global(context, gjs_get_import_global(context));
     proto_priv = priv_from_js(context, proto);
 
-    obj = JS_NewObjectWithGivenProto(context, JS_GetClass(proto), proto, global);
+    JS::RootedObject obj(context,
+        JS_NewObjectWithGivenProto(context, JS_GetClass(proto), proto, global));
 
     GJS_INC_COUNTER(gerror);
     priv = g_slice_new0(Error);


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