[gjs/wip/ptomato/mozjs31prep] js: Root misc function, keep-alive, ns
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/wip/ptomato/mozjs31prep] js: Root misc function, keep-alive, ns
- Date: Sat, 29 Oct 2016 00:43:56 +0000 (UTC)
commit a2c4ec323c6a52d9635975225c954ad65190db5d
Author: Philip Chimento <philip endlessm com>
Date: Fri Oct 28 17:37:54 2016 -0700
js: Root misc function, keep-alive, ns
This converts everything else in function.cpp, keep-alive.cpp, and ns.cpp
to use exact rooting, that would otherwise have caused a compile error in
mozjs31.
(I did function.cpp in an earlier commit, but missed one spot.)
https://bugzilla.gnome.org/show_bug.cgi?id=742249
gi/function.cpp | 3 ++-
gi/keep-alive.cpp | 7 +++----
gi/ns.cpp | 3 +--
3 files changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/gi/function.cpp b/gi/function.cpp
index 21a8308..fccd5e7 100644
--- a/gi/function.cpp
+++ b/gi/function.cpp
@@ -219,6 +219,7 @@ gjs_callback_closure(ffi_cif *cif,
JS::AutoValueVector jsargs(context);
jsargs.reserve(n_args);
JS::RootedValue rval(context);
+ JS::RootedValue rooted_function(context, trampoline->js_function);
JS::RootedObject this_object(context);
for (i = 0, n_jsargs = 0; i < n_args; i++) {
@@ -290,7 +291,7 @@ gjs_callback_closure(ffi_cif *cif,
if (!JS_CallFunctionValue(context,
this_object,
- trampoline->js_function,
+ rooted_function,
n_jsargs,
jsargs.begin(),
rval.address())) {
diff --git a/gi/keep-alive.cpp b/gi/keep-alive.cpp
index 0464a98..00701f4 100644
--- a/gi/keep-alive.cpp
+++ b/gi/keep-alive.cpp
@@ -176,7 +176,6 @@ static JSObject *
gjs_keep_alive_new(JSContext *context)
{
KeepAlive *priv;
- JSObject *global;
JSBool found;
/* This function creates an unattached KeepAlive object; following our
@@ -189,7 +188,7 @@ gjs_keep_alive_new(JSContext *context)
JSAutoRequest ar(context);
- global = gjs_get_import_global(context);
+ JS::RootedObject global(context, gjs_get_import_global(context));
g_assert(global != NULL);
@@ -201,7 +200,7 @@ gjs_keep_alive_new(JSContext *context)
gjs_debug(GJS_DEBUG_KEEP_ALIVE,
"Initializing keep-alive class in context %p global %p",
- context, global);
+ context, global.get());
prototype = JS_InitClass(context, global,
/* parent prototype JSObject* for
@@ -234,7 +233,7 @@ gjs_keep_alive_new(JSContext *context)
gjs_debug(GJS_DEBUG_KEEP_ALIVE,
"Creating new keep-alive object for context %p global %p",
- context, global);
+ context, global.get());
JS::RootedObject keep_alive(context,
JS_NewObject(context, &gjs_keep_alive_class, NULL, global));
diff --git a/gi/ns.cpp b/gi/ns.cpp
index 6126b09..293dea6 100644
--- a/gi/ns.cpp
+++ b/gi/ns.cpp
@@ -192,12 +192,11 @@ static JSObject*
ns_new(JSContext *context,
const char *ns_name)
{
- JSObject *global;
Ns *priv;
JSBool found;
/* put constructor in the global namespace */
- global = gjs_get_import_global(context);
+ JS::RootedObject global(context, gjs_get_import_global(context));
if (!JS_HasProperty(context, global, gjs_ns_class.name, &found))
return NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]