[gjs: 1/2] gobject: Use auto-compartment on object when setting property
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs: 1/2] gobject: Use auto-compartment on object when setting property
- Date: Thu, 25 Apr 2019 19:22:29 +0000 (UTC)
commit f4148e7e7e4b606660ecbbf0dc124dd01c89d849
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date: Thu Apr 25 14:06:35 2019 -0500
gobject: Use auto-compartment on object when setting property
When binding a property inherited from the object to another
gobject property added in Javascript, it could happen that gjs
crashes when setting the property.
So enter a new compartment when doing this.
Fixes https://gitlab.gnome.org/GNOME/gjs/issues/246
gi/gobject.cpp | 2 ++
1 file changed, 2 insertions(+)
---
diff --git a/gi/gobject.cpp b/gi/gobject.cpp
index 0c54f4e4..4ed784e2 100644
--- a/gi/gobject.cpp
+++ b/gi/gobject.cpp
@@ -145,6 +145,8 @@ static void gjs_object_set_gproperty(GObject* object, unsigned property_id,
JSContext *cx = current_context();
JS::RootedObject js_obj(cx, priv->wrapper());
+ JSAutoCompartment ac(cx, js_obj);
+
if (!jsobj_set_gproperty(cx, js_obj, value, pspec))
gjs_log_exception(cx);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]