[telepathy-gabble/master] Correct refcounting when requesting multiple tubes from one muc

Sjoerd Simons sjoerd.simons at collabora.co.uk
Thu Jan 7 05:37:26 PST 2010


---
 src/muc-factory.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/muc-factory.c b/src/muc-factory.c
index 5fc7b21..3fc4817 100644
--- a/src/muc-factory.c
+++ b/src/muc-factory.c
@@ -1123,8 +1123,6 @@ ensure_tubes_channel (GabbleMucFactory *self,
   if (!result)
     g_hash_table_insert (priv->text_needed_for_tubes, text_chan, *tubes_chan);
 
-  g_object_unref (tubes_chan);
-
   return result;
 }
 
@@ -1219,6 +1217,8 @@ handle_tubes_channel_request (GabbleMucFactory *self,
       gabble_muc_factory_associate_request (self, tube, request_token);
     }
 
+  g_object_unref (tube);
+
   return TRUE;
 }
 
@@ -1234,12 +1234,14 @@ handle_tube_channel_request (GabbleMucFactory *self,
   GabbleMucFactoryPrivate *priv = GABBLE_MUC_FACTORY_GET_PRIVATE (self);
   gboolean can_announce_now = TRUE;
   gboolean tubes_channel_created = FALSE;
-  GabbleTubesChannel *tube;
+  GabbleTubesChannel *tube = NULL;
   GabbleMucChannel * gmuc;
   GabbleTubeIface *new_channel;
 
   gmuc = g_hash_table_lookup (priv->text_channels, GUINT_TO_POINTER (handle));
-  g_object_get (gmuc, "tube", &tube, NULL);
+
+  if (gmuc != NULL)
+    g_object_get (gmuc, "tube", &tube, NULL);
 
   if (tube == NULL)
     {
@@ -1290,6 +1292,8 @@ handle_tube_channel_request (GabbleMucFactory *self,
       g_hash_table_insert (priv->tubes_needed_for_tube, tube, l);
     }
 
+  g_object_unref (tube);
+
   return TRUE;
 }
 
-- 
1.5.6.5




More information about the telepathy-commits mailing list