[telepathy-mission-control/master] Never invoke the callback twice

Alberto Mardegan alberto.mardegan at nokia.com
Thu Jul 9 03:52:19 PDT 2009


If the object was already in ready state, the callback was being invoked twice.
An extra lock ensure this won't happen.
---
 libmcclient/dbus-api.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/libmcclient/dbus-api.c b/libmcclient/dbus-api.c
index 70eb0e7..c897052 100644
--- a/libmcclient/dbus-api.c
+++ b/libmcclient/dbus-api.c
@@ -312,6 +312,7 @@ _mc_iface_call_when_all_readyv (TpProxy *proxy, GType type,
     mcbd->user_data = user_data;
     mcbd->destroy = destroy;
     mcbd->ref_count = 1;
+    mcbd->remaining_ifaces = 1; /* lock released at the end of this function */
 
     for (i = 0; i < n_ifaces; i++)
     {
@@ -322,6 +323,10 @@ _mc_iface_call_when_all_readyv (TpProxy *proxy, GType type,
 				   call_when_all_ready_cb,
 				   mcbd, multi_cb_data_free, weak_object);
     }
+
+    /* release the initial lock set to remaining_ifaces */
+    call_when_all_ready_cb (proxy, NULL, mcbd, weak_object);
+
     multi_cb_data_free (mcbd);
 }
 
-- 
1.5.6.5



More information about the telepathy-commits mailing list