[gjs] object: Check for error on gjs_value_to_g_value()
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs] object: Check for error on gjs_value_to_g_value()
- Date: Wed, 28 Sep 2016 02:00:35 +0000 (UTC)
commit b136107eef97db27b12fafe74e86fe29f8ebd772
Author: Philip Chimento <philip chimento gmail com>
Date: Mon Sep 26 23:10:45 2016 -0700
object: Check for error on gjs_value_to_g_value()
Without this error check, it is possible for an exception to be left
pending, and mozjs will assert about that if compiled with debug flags.
Adding the error check exposed an additional bug in
testExceptionInPropertySetterWithBinding(); without the G_PARAM_CONSTRUCT
flag the getter would return undefined because the property had never
been set.
https://bugzilla.gnome.org/show_bug.cgi?id=573335
gi/object.cpp | 5 ++---
installed-tests/js/testExceptions.js | 3 ++-
2 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/gi/object.cpp b/gi/object.cpp
index cfca5d3..ba8d663 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -2402,10 +2402,9 @@ gjs_object_get_gproperty (GObject *object,
js_obj = peek_js_obj(object);
underscore_name = hyphen_to_underscore((gchar *)pspec->name);
- if (!JS_GetProperty(context, js_obj, underscore_name, &jsvalue))
+ if (!JS_GetProperty(context, js_obj, underscore_name, &jsvalue) ||
+ !gjs_value_to_g_value(context, jsvalue, value))
gjs_log_exception(context);
- else
- gjs_value_to_g_value(context, jsvalue, value);
g_free (underscore_name);
}
diff --git a/installed-tests/js/testExceptions.js b/installed-tests/js/testExceptions.js
index c69a0c9..2a12fff 100644
--- a/installed-tests/js/testExceptions.js
+++ b/installed-tests/js/testExceptions.js
@@ -23,7 +23,8 @@ const Bar = new Lang.Class({
Name: 'Bar',
Extends: GObject.Object,
Properties: {
- 'prop': GObject.ParamSpec.string('prop', '', '', GObject.ParamFlags.READWRITE, '')
+ 'prop': GObject.ParamSpec.string('prop', '', '',
+ GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT, ''),
}
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]