[empathy] tube_is_ready: ensure than tube stays alive while we are calling the callbacks



commit d6c6a79e061cd5124b61492ce30b23a8fdd99a92
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Tue May 5 17:28:47 2009 +0100

    tube_is_ready: ensure than tube stays alive while we are calling the callbacks
---
 libempathy/empathy-tp-tube.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/libempathy/empathy-tp-tube.c b/libempathy/empathy-tp-tube.c
index 717c468..1946881 100644
--- a/libempathy/empathy-tp-tube.c
+++ b/libempathy/empathy-tp-tube.c
@@ -258,6 +258,8 @@ tube_is_ready (EmpathyTpTube *self,
 
   priv->ready = TRUE;
 
+  /* tube has to stay alive while we call the callbacks */
+  g_object_ref (self);
   for (l = priv->ready_callbacks ; l != NULL ; l = g_slist_next (l))
     {
       ReadyCbData *data = (ReadyCbData *) l->data;
@@ -265,6 +267,7 @@ tube_is_ready (EmpathyTpTube *self,
       data->callback (self, error, data->user_data, data->weak_object);
       ready_cb_data_free (data, self);
     }
+  g_object_unref (self);
 
   g_slist_free (priv->ready_callbacks);
   priv->ready_callbacks = NULL;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]