summaryrefslogtreecommitdiff
path: root/gdbus
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2012-12-27 21:30:06 -0800
committerMarcel Holtmann <marcel@holtmann.org>2012-12-27 23:59:31 -0800
commitf2e9dce4d5e2bc7610d71b90b4513634d5157c87 (patch)
treec9e600f69a08966d5f18be2157f19b0b12ae9e11 /gdbus
parent3f937cc14291354427ee0c3a74ec079b4548f3cb (diff)
downloadconnman-f2e9dce4d5e2bc7610d71b90b4513634d5157c87.tar.gz
connman-f2e9dce4d5e2bc7610d71b90b4513634d5157c87.tar.bz2
connman-f2e9dce4d5e2bc7610d71b90b4513634d5157c87.zip
gdbus: Use object manager only if callback functions are set
Diffstat (limited to 'gdbus')
-rw-r--r--gdbus/client.c15
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;
}