diff options
| author | Philip Chimento <philip@endlessm.com> | 2016-09-29 19:25:01 -0700 |
|---|---|---|
| committer | Philip Chimento <philip.chimento@gmail.com> | 2016-09-30 16:49:12 -0700 |
| commit | 9fb00a1ba3280802fd4786b8a2265246f3f6edc2 (patch) | |
| tree | 0dc64637dacd02b8f0e3c6792733dcd163497f6b /modules/cairo-context.cpp | |
| parent | 9fbf77bc357b7fd4cd8b59d99bd2d8982d30222a (diff) | |
| download | gjs-9fb00a1ba3280802fd4786b8a2265246f3f6edc2.tar.gz | |
js: Replace JS_Add*Root with Rooted where trivial
Instead of using JS_AddFooRoot and JS_RemoveFooRoot on a value within the
same scope, we should use JS::Rooted which is the mozjs31-style API.
Besides being RAII and more readable, it will be required when mozjs API
functions start taking JS::Handle parameters in mozjs31. This commit
makes that change in places where it doesn't propagate into the API.
https://bugzilla.gnome.org/show_bug.cgi?id=742249
Diffstat (limited to 'modules/cairo-context.cpp')
| -rw-r--r-- | modules/cairo-context.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/modules/cairo-context.cpp b/modules/cairo-context.cpp index 8fca4207..ed03cc19 100644 --- a/modules/cairo-context.cpp +++ b/modules/cairo-context.cpp @@ -566,17 +566,16 @@ setDash_func(JSContext *context, guint i; cairo_t *cr; - JSObject *dashes; + JS::RootedObject dashes(context); double offset; bool retval = false; guint len; GArray *dashes_c = NULL; if (!gjs_parse_call_args(context, "setDash", "of", argv, - "dashes", &dashes, "offset", &offset)) + "dashes", dashes.address(), "offset", &offset)) return false; - JS_AddObjectRoot(context, &dashes); if (!JS_IsArrayObject(context, dashes)) { gjs_throw(context, "dashes must be an array"); @@ -617,7 +616,6 @@ setDash_func(JSContext *context, out: if (dashes_c != NULL) g_array_free (dashes_c, true); - JS_RemoveObjectRoot(context, &dashes); return retval; } |
