summaryrefslogtreecommitdiff
path: root/gdbus
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2016-03-08 13:33:25 +0200
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2016-03-08 13:33:25 +0200
commitbf497206a7b37268759c26e6a89d717a33e739ec (patch)
treeb1edf25c6c3ea86bd7720a7169dcdf461f2b32bb /gdbus
parent4432ec8b4e177f4ab2456ecae10dff69487d11d9 (diff)
downloadbluez-bf497206a7b37268759c26e6a89d717a33e739ec.tar.gz
gdbus/client: Use g_dbus_send_message if callback is not set
If the user don't set a function it means it doesn't care about the reply so g_dbus_send_message can be used.
Diffstat (limited to 'gdbus')
-rw-r--r--gdbus/client.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/gdbus/client.c b/gdbus/client.c
index 068e778ce..a011e19c3 100644
--- a/gdbus/client.c
+++ b/gdbus/client.c
@@ -853,28 +853,30 @@ gboolean g_dbus_proxy_method_call(GDBusProxy *proxy, const char *method,
if (client == NULL)
return FALSE;
- data = g_try_new0(struct method_call_data, 1);
- if (data == NULL)
- return FALSE;
-
- data->function = function;
- data->user_data = user_data;
- data->destroy = destroy;
-
msg = dbus_message_new_method_call(client->service_name,
proxy->obj_path, proxy->interface, method);
- if (msg == NULL) {
- g_free(data);
+ if (msg == NULL)
return FALSE;
- }
if (setup) {
DBusMessageIter iter;
dbus_message_iter_init_append(msg, &iter);
- setup(&iter, data->user_data);
+ setup(&iter, user_data);
}
+ if (!function)
+ return g_dbus_send_message(client->dbus_conn, msg);
+
+ data = g_try_new0(struct method_call_data, 1);
+ if (data == NULL)
+ return FALSE;
+
+ data->function = function;
+ data->user_data = user_data;
+ data->destroy = destroy;
+
+
if (g_dbus_send_message_with_reply(client->dbus_conn, msg,
&call, METHOD_CALL_TIMEOUT) == FALSE) {
dbus_message_unref(msg);