[empathy: 144/148] Free the cb_data after errors in construction



commit e2fa5b38c29e8b2c1572ff477ef602b739791f57
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Mon Jun 1 17:14:07 2009 +0200

    Free the cb_data after errors in construction
---
 libempathy/empathy-ft-handler.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/libempathy/empathy-ft-handler.c b/libempathy/empathy-ft-handler.c
index 5b6f97b..ba81fd4 100644
--- a/libempathy/empathy-ft-handler.c
+++ b/libempathy/empathy-ft-handler.c
@@ -1088,6 +1088,7 @@ find_ft_channel_classes_cb (GList *channel_classes,
 {
   CallbacksData *data = user_data;
   EmpathyFTHandler *handler = data->handler;
+  EmpathyFTHandlerPriv *priv = GET_PRIV (handler);
   GError *myerr = NULL;
 
   if (channel_classes == NULL)
@@ -1096,6 +1097,9 @@ find_ft_channel_classes_cb (GList *channel_classes,
           EMPATHY_FT_ERROR_NOT_SUPPORTED,
           _("File transfer not supported by remote contact"));
 
+      if (!g_cancellable_is_cancelled (priv->cancellable))
+        g_cancellable_cancel (priv->cancellable);
+
       data->callback (handler, myerr, data->user_data);
       g_clear_error (&myerr);
     }
@@ -1161,9 +1165,8 @@ out:
       if (!g_cancellable_is_cancelled (priv->cancellable))
         g_cancellable_cancel (priv->cancellable);
 
-      cb_data->callback (NULL, error, cb_data->user_data);
+      cb_data->callback (cb_data->handler, error, cb_data->user_data);
       g_error_free (error);
-      g_object_unref (cb_data->handler);
 
       callbacks_data_free (cb_data);
     }
@@ -1194,8 +1197,8 @@ contact_factory_contact_cb (EmpathyTpContactFactory *factory,
       if (!g_cancellable_is_cancelled (priv->cancellable))
         g_cancellable_cancel (priv->cancellable);
 
-      cb_data->callback (NULL, (GError *) error, cb_data->user_data);
-      g_object_unref (handler);
+      cb_data->callback (handler, (GError *) error, cb_data->user_data);
+      callbacks_data_free (cb_data);
       return;
     }
 
@@ -1222,8 +1225,9 @@ channel_get_all_properties_cb (TpProxy *proxy,
       if (!g_cancellable_is_cancelled (priv->cancellable))
         g_cancellable_cancel (priv->cancellable);
 
-      cb_data->callback (NULL, (GError *) error, cb_data->user_data);
-      g_object_unref (handler);
+      cb_data->callback (handler, (GError *) error, cb_data->user_data);
+
+      callbacks_data_free (cb_data);
       return;
     }
 



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