[gjs/wip/xulrunner-1.9.3-rebase5: 15/26] dbus: Root bus prototype object
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/wip/xulrunner-1.9.3-rebase5: 15/26] dbus: Root bus prototype object
- Date: Thu, 23 Sep 2010 00:05:18 +0000 (UTC)
commit 6f555ff482df0e6a27da7a9037cd179dd1da153d
Author: Colin Walters <walters verbum org>
Date: Tue Sep 21 10:56:48 2010 -0400
dbus: Root bus prototype object
This wasn't the bug I was looking for, but it certainly looks
like we need to do this.
modules/dbus.c | 32 ++++++++++++++++++++++----------
1 files changed, 22 insertions(+), 10 deletions(-)
---
diff --git a/modules/dbus.c b/modules/dbus.c
index 2f4b928..32af09d 100644
--- a/modules/dbus.c
+++ b/modules/dbus.c
@@ -1780,6 +1780,12 @@ gjs_js_define_dbus_stuff(JSContext *context,
JSObject *module_obj)
{
JSObject *bus_proto_obj;
+ jsval bus_proto_val;
+ JSBool retval = JS_FALSE;
+
+ bus_proto_val = JSVAL_NULL;
+ JS_AddValueRoot(context, &bus_proto_val);
+
/* Note that we don't actually connect to dbus in here, since the
* JS program may not even be using it.
*/
@@ -1788,53 +1794,59 @@ gjs_js_define_dbus_stuff(JSContext *context,
"signatureLength",
gjs_js_dbus_signature_length,
1, GJS_MODULE_PROP_FLAGS))
- return JS_FALSE;
+ goto out;
if (!JS_DefineProperty(context, module_obj,
"BUS_SESSION",
INT_TO_JSVAL(DBUS_BUS_SESSION),
NULL, NULL,
GJS_MODULE_PROP_FLAGS))
- return JS_FALSE;
+ goto out;
if (!JS_DefineProperty(context, module_obj,
"BUS_SYSTEM",
INT_TO_JSVAL(DBUS_BUS_SYSTEM),
NULL, NULL,
GJS_MODULE_PROP_FLAGS))
- return JS_FALSE;
+ goto out;
if (!JS_DefineProperty(context, module_obj,
"BUS_STARTER",
INT_TO_JSVAL(DBUS_BUS_STARTER),
NULL, NULL,
GJS_MODULE_PROP_FLAGS))
- return JS_FALSE;
+ goto out;
if (!JS_DefineProperty(context, module_obj,
"localMachineID",
JSVAL_VOID,
gjs_js_dbus_get_machine_id, NULL,
GJS_MODULE_PROP_FLAGS))
- return JS_FALSE;
+ goto out;
if (!JS_DefineFunction(context, module_obj,
"getCurrentMessageContext",
gjs_js_dbus_get_current_message_context,
0, GJS_MODULE_PROP_FLAGS))
- return JS_FALSE;
+ goto out;
/* Define both the session and system objects */
if (!define_bus_proto(context, module_obj, &bus_proto_obj))
- return JS_FALSE;
+ goto out;
+
+ bus_proto_val = OBJECT_TO_JSVAL(bus_proto_obj);
if (!define_bus_object(context, module_obj, bus_proto_obj, DBUS_BUS_SESSION))
- return JS_FALSE;
+ goto out;
if (!define_bus_object(context, module_obj, bus_proto_obj, DBUS_BUS_SYSTEM))
- return JS_FALSE;
+ goto out;
- return JS_TRUE;
+ retval = JS_TRUE;
+ out:
+ JS_RemoveValueRoot(context, &bus_proto_val);
+
+ return retval;
}
GJS_REGISTER_NATIVE_MODULE("dbusNative", gjs_js_define_dbus_stuff)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]