[gjs: 1/2] gobject: Use auto-compartment when getting property as well
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs: 1/2] gobject: Use auto-compartment when getting property as well
- Date: Tue, 30 Jul 2019 22:37:52 +0000 (UTC)
commit 81dd53ee063bd6711a3312064b41bc2e045cc0a9
Author: Florian Müllner <fmuellner gnome org>
Date: Wed Jul 31 00:11:36 2019 +0200
gobject: Use auto-compartment when getting property as well
Commit f4148e7e7e added the corresponding call to set_gproperty()
to fix crashes when setting a Javascript GObject property from C,
but left get_gproperty() with the same issue.
Also make sure that we have an active request in both cases.
https://gitlab.gnome.org/GNOME/gjs/merge_requests/316
gi/gobject.cpp | 3 +++
1 file changed, 3 insertions(+)
---
diff --git a/gi/gobject.cpp b/gi/gobject.cpp
index cc17086b..7a430255 100644
--- a/gi/gobject.cpp
+++ b/gi/gobject.cpp
@@ -151,6 +151,7 @@ static void gjs_object_set_gproperty(GObject* object,
JSContext *cx = current_context();
JS::RootedObject js_obj(cx, priv->wrapper());
+ JSAutoRequest ar(cx);
JSAutoCompartment ac(cx, js_obj);
if (!jsobj_set_gproperty(cx, js_obj, value, pspec))
@@ -165,6 +166,8 @@ static void gjs_object_get_gproperty(GObject* object,
JS::RootedObject js_obj(cx, priv->wrapper());
JS::RootedValue jsvalue(cx);
+ JSAutoRequest ar(cx);
+ JSAutoCompartment ac(cx, js_obj);
GjsAutoChar underscore_name = gjs_hyphen_to_underscore(pspec->name);
if (!JS_GetProperty(cx, js_obj, underscore_name, &jsvalue) ||
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]