[Telepathy-commits] [telepathy-gabble/master] conn-olpc: extract_current_activity: don't ref the activity if we just created it

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Fri Sep 26 10:02:52 PDT 2008


20080729084318-7fe3f-388bd55e7af454f52229917874642aaac43bf885.gz
---
 src/conn-olpc.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/conn-olpc.c b/src/conn-olpc.c
index ee1458f..550e43b 100644
--- a/src/conn-olpc.c
+++ b/src/conn-olpc.c
@@ -1375,6 +1375,7 @@ extract_current_activity (GabbleConnection *conn,
   TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (
       (TpBaseConnection *) conn, TP_HANDLE_TYPE_CONTACT);
   TpHandle room_handle, contact_handle;
+  gboolean created = FALSE;
 
   if (node == NULL)
     return NULL;
@@ -1414,6 +1415,7 @@ extract_current_activity (GabbleConnection *conn,
       activity = add_activity_info_in_set (conn, room_handle, contact,
           conn->olpc_pep_activities);
       g_object_set (activity, "id", id, NULL);
+      created = TRUE;
     }
 
   tp_handle_unref (room_repo, room_handle);
@@ -1424,7 +1426,8 @@ extract_current_activity (GabbleConnection *conn,
       g_hash_table_insert (conn->olpc_current_act,
           GUINT_TO_POINTER (contact_handle), activity);
 
-      g_object_ref (activity);
+      if (!created)
+        g_object_ref (activity);
     }
   else
     {
-- 
1.5.6.5




More information about the Telepathy-commits mailing list