Revert "core: Fix unnecessary calls to agent_cancel()" 11/33711/2
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Tue, 28 Oct 2014 11:31:26 +0000 (13:31 +0200)
committerChanglong Xie <changlongx.xie@intel.com>
Wed, 14 Jan 2015 04:34:33 +0000 (12:34 +0800)
agent_cancel calls are necessary since agent_unref only call it in case
the last reference is dropped.

Taken from upstream:
http://git.kernel.org/cgit/bluetooth/bluez.git/commit/?id=a67b0480a2c45b0d11e4db4142fc95fb36287dda

Change-Id: Ie50bc59bdb33ea7e711c4ae244c7dcf8c83c0b47
Signed-off-by: Changlong Xie <changlongx.xie@intel.com>
src/adapter.c
src/agent.c
src/device.c

index a3722e2..60a0ad8 100644 (file)
@@ -1076,8 +1076,10 @@ static void service_auth_cancel(struct service_auth *auth)
 
        dbus_error_free(&derr);
 
-       if (auth->agent != NULL)
+       if (auth->agent != NULL) {
+               agent_cancel(auth->agent);
                agent_unref(auth->agent);
+       }
 
        g_free(auth);
 }
@@ -4782,8 +4784,10 @@ int btd_cancel_authorization(guint id)
 
        g_queue_remove(auth->adapter->auths, auth);
 
-       if (auth->agent)
+       if (auth->agent) {
+               agent_cancel(auth->agent);
                agent_unref(auth->agent);
+       }
 
        g_free(auth);
 
index d23550f..b05e529 100644 (file)
@@ -349,6 +349,7 @@ static void simple_agent_reply(DBusPendingCall *call, void *user_data)
 
                if (dbus_error_has_name(&err, DBUS_ERROR_NO_REPLY)) {
                        error("Timed out waiting for reply from agent");
+                       agent_cancel(agent);
                        dbus_message_unref(message);
                        dbus_error_free(&err);
                        agent_unref(agent);
index d55b9cd..fd0485a 100644 (file)
@@ -1861,6 +1861,7 @@ static void bonding_request_free(struct bonding_req *bonding)
                g_free(bonding->cb_iter);
 
        if (bonding->agent) {
+               agent_cancel(bonding->agent);
                agent_unref(bonding->agent);
                bonding->agent = NULL;
        }