diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2012-12-27 21:30:06 -0800 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2012-12-27 23:59:43 -0800 |
commit | 5f6cb2663705f050c449eac53228e4d2ec7d7b78 (patch) | |
tree | 4146b8570d35864c7b7c61941b852b7ca2f008c5 | |
parent | b151f06d89aff8b4c6e6659da6c8e45a3bfcbbbf (diff) | |
download | neard-5f6cb2663705f050c449eac53228e4d2ec7d7b78.tar.gz neard-5f6cb2663705f050c449eac53228e4d2ec7d7b78.tar.bz2 neard-5f6cb2663705f050c449eac53228e4d2ec7d7b78.zip |
gdbus: Use object manager only if callback functions are set
-rw-r--r-- | gdbus/client.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/gdbus/client.c b/gdbus/client.c index 8bb525b..536121f 100644 --- a/gdbus/client.c +++ b/gdbus/client.c @@ -871,15 +871,13 @@ static void get_managed_objects_reply(DBusPendingCall *call, void *user_data) done: dbus_message_unref(reply); - dbus_pending_call_unref(client->pending_call); - client->pending_call = NULL; - g_dbus_client_unref(client); } static void get_managed_objects(GDBusClient *client) { DBusMessage *msg; + DBusPendingCall *call; msg = dbus_message_new_method_call(client->service_name, "/", DBUS_INTERFACE_DBUS ".ObjectManager", @@ -890,15 +888,16 @@ static void get_managed_objects(GDBusClient *client) dbus_message_append_args(msg, DBUS_TYPE_INVALID); if (dbus_connection_send_with_reply(client->dbus_conn, msg, - &client->pending_call, -1) == FALSE) { + &call, -1) == FALSE) { dbus_message_unref(msg); return; } g_dbus_client_ref(client); - dbus_pending_call_set_notify(client->pending_call, - get_managed_objects_reply, client, NULL); + dbus_pending_call_set_notify(call, get_managed_objects_reply, + client, NULL); + dbus_pending_call_unref(call); dbus_message_unref(msg); } @@ -935,8 +934,6 @@ done: dbus_pending_call_unref(client->pending_call); client->pending_call = NULL; - get_managed_objects(client); - g_dbus_client_unref(client); } @@ -1220,5 +1217,7 @@ gboolean g_dbus_client_set_proxy_handlers(GDBusClient *client, client->property_changed = property_changed; client->user_data = user_data; + get_managed_objects(client); + return TRUE; } |