[gjs] dbus: improve async callback handling
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs] dbus: improve async callback handling
- Date: Mon, 6 Dec 2010 22:34:54 +0000 (UTC)
commit e5096b09fda754900f9fe43333c52fd8ce9305a9
Author: Ray Strode <rstrode redhat com>
Date: Wed Oct 20 17:06:45 2010 -0400
dbus: improve async callback handling
When using the "async" technqiue of exporting dbus methods, it's
the responsibility of the service to call the passed in callback
function when it's time to send the reply.
This callback function takes the return value or an array of return
values (matched in order one by one with the types mentioned in the
out signature for the method).
Some methods don't have any out signature though. Right now, these
methods are required to call the callback with an empty array
argument.
This commit changes gjs to be more flexible and allow the caller to
invoke the callback with no arguments for this particular "empty
out signature" case.
modules/dbus-exports.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/modules/dbus-exports.c b/modules/dbus-exports.c
index 8a685d3..ce79c7e 100644
--- a/modules/dbus-exports.c
+++ b/modules/dbus-exports.c
@@ -453,7 +453,8 @@ async_call_callback(JSContext *context,
if (!signature)
goto fail;
- if (argc != 1) {
+ if (argc == 0 && !g_str_equal(signature, "") ||
+ argc > 1) {
gjs_throw(context, "The callback to async DBus calls takes one argument, "
"the return value or array of return values");
thrown = TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]