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:19 -0800 |
commit | 9ba681ddcdfb78418e4b7780c2d99a7f0f1816d0 (patch) | |
tree | 59f475093a8b1c6ff8004cab85e8c7a34512b4f4 /gdbus | |
parent | 91e3369a38f307d02c34e0d2847cb830e4d38cb8 (diff) | |
download | ofono-9ba681ddcdfb78418e4b7780c2d99a7f0f1816d0.tar.bz2 |
gdbus: Use object manager only if callback functions are set
Diffstat (limited to 'gdbus')
-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 8bb525b2..536121f3 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; } |