From e2fa5b38c29e8b2c1572ff477ef602b739791f57 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Mon, 1 Jun 2009 17:14:07 +0200 Subject: Free the cb_data after errors in construction --- libempathy/empathy-ft-handler.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'libempathy/empathy-ft-handler.c') diff --git a/libempathy/empathy-ft-handler.c b/libempathy/empathy-ft-handler.c index 5b6f97b78..ba81fd4c7 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; } -- cgit v1.2.3