[Telepathy-commits] [telepathy-gabble/master] vcard-manager: cache_entry_complete_requests: copy the next element from the pending requests list so we can safely rely on it to check if the list is empty"

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Tue Aug 19 10:54:14 PDT 2008


20080731101424-7fe3f-65aba9d458385c13a2453dcf3d74ca5e8252f81c.gz
---
 src/vcard-manager.c |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/vcard-manager.c b/src/vcard-manager.c
index af41ac2..75d2770 100644
--- a/src/vcard-manager.c
+++ b/src/vcard-manager.c
@@ -451,16 +451,15 @@ static void complete_one_request (GabbleVCardManagerRequest *request,
 static void
 cache_entry_complete_requests (GabbleVCardCacheEntry *entry, GError *error)
 {
-  GabbleVCardManagerPrivate *priv = GABBLE_VCARD_MANAGER_GET_PRIVATE
-      (entry->manager);
-  TpHandle handle;
+  GSList *cur;
 
-  handle = entry->handle;
-
-  while (g_hash_table_lookup (priv->cache, GUINT_TO_POINTER (handle)) != NULL &&
-      entry->pending_requests)
+  cur = entry->pending_requests;
+  while (cur != NULL)
     {
-      GabbleVCardManagerRequest *request = entry->pending_requests->data;
+      GabbleVCardManagerRequest *request = cur->data;
+
+      /* advance cur before we complete the request, as it can free the entry */
+      cur = g_slist_next (cur);
 
       complete_one_request (request, error ? NULL : entry->vcard_node, error);
     }
-- 
1.5.6.3




More information about the Telepathy-commits mailing list