/srv/mercurial-server/detachablepurple: 4fd9773c1c5d: Fixed the ...
Gilles Bedel
gillux at cpw.pidgin.im
Fri Jun 15 22:01:50 EDT 2012
Changeset: 4fd9773c1c5dd670ddc81dd303757237995449c9
Author: Gilles Bedel <gillux at cpw.pidgin.im>
Date: 2012-05-25 19:32 +0000
Branch: cpw.gillux.detachablepurple
URL: http://hg.pidgin.im/srv/mercurial-server/detachablepurple/rev/4fd9773c1c5d
Description:
Fixed the calling of D-Bus methods that doesn't return values.
diffstat:
libpurple/pobject.c | 26 +++++++++++++++++---------
1 files changed, 17 insertions(+), 9 deletions(-)
diffs (55 lines):
diff --git a/libpurple/pobject.c b/libpurple/pobject.c
--- a/libpurple/pobject.c
+++ b/libpurple/pobject.c
@@ -762,6 +762,7 @@
GValue ret_val = {0, };
GClosure *closure;
guint i, num_params;
+ GDBusMethodInfo *method_info;
/* Get the binded function back. */
closure = purple_object_get_dbus_closure(PURPLE_OBJECT_GET_CLASS(object),
@@ -776,27 +777,34 @@
purple_gvariant_to_gvalue_closure_args(object, params,
¶mv, &num_params);
+ /* Check if this method has a return value. */
+ method_info = g_dbus_method_invocation_get_method_info(invoc);
+ if (!method_info->out_args) {
+ g_closure_invoke(closure, NULL, num_params, paramv, NULL);
+ g_dbus_method_invocation_return_value(invoc, NULL);
+ } else {
/* We don't want to force such a recent version, so keep a shitty workaround. */
#if GLIB_CHECK_VERSION(2, 32, 1)
- g_value_init(&ret_val, G_TYPE_VARIANT);
+ g_value_init(&ret_val, G_TYPE_VARIANT);
- /* Execute the callback. */
- g_closure_invoke(closure, &ret_val, num_params, paramv, NULL);
- g_dbus_method_invocation_return_value(invoc,
+ /* Execute the callback. */
+ g_closure_invoke(closure, &ret_val, num_params, paramv, NULL);
+ g_dbus_method_invocation_return_value(invoc,
g_value_get_variant(&ret_val));
#else
- g_value_init(&ret_val, G_TYPE_POINTER);
+ g_value_init(&ret_val, G_TYPE_POINTER);
- /* Execute the callback. */
- g_closure_invoke(closure, &ret_val, num_params, paramv, NULL);
- g_dbus_method_invocation_return_value(invoc,
+ /* Execute the callback. */
+ g_closure_invoke(closure, &ret_val, num_params, paramv, NULL);
+ g_dbus_method_invocation_return_value(invoc,
(GVariant*)g_value_get_pointer(&ret_val));
#endif
+ g_value_unset(&ret_val);
+ }
for (i = 0; i < num_params; i++)
g_value_unset (¶mv[i]);
g_free (paramv);
- g_value_unset(&ret_val);
}
GVariant *
More information about the Commits
mailing list