aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimo.cecchi@collabora.co.uk>2009-05-05 23:42:23 +0800
committerCosimo Cecchi <cosimoc@gnome.org>2009-06-01 23:47:39 +0800
commit50577c500cd3a4ed96e024383c720264b130b416 (patch)
tree3fad71d2f7a57649fb8ba6bd27f5c7be01574aa3 /libempathy
parent53073da65b919bd68a26e5e0e276ec5ba15f51ea (diff)
downloadgsoc2013-empathy-50577c500cd3a4ed96e024383c720264b130b416.tar
gsoc2013-empathy-50577c500cd3a4ed96e024383c720264b130b416.tar.gz
gsoc2013-empathy-50577c500cd3a4ed96e024383c720264b130b416.tar.bz2
gsoc2013-empathy-50577c500cd3a4ed96e024383c720264b130b416.tar.lz
gsoc2013-empathy-50577c500cd3a4ed96e024383c720264b130b416.tar.xz
gsoc2013-empathy-50577c500cd3a4ed96e024383c720264b130b416.tar.zst
gsoc2013-empathy-50577c500cd3a4ed96e024383c720264b130b416.zip
Ensure the callbacks are only run once
Also ensure that we get no progress callbacks after the transfer has been cancelled.
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-ft-handler.c3
-rw-r--r--libempathy/empathy-tp-file.c12
2 files changed, 15 insertions, 0 deletions
diff --git a/libempathy/empathy-ft-handler.c b/libempathy/empathy-ft-handler.c
index 6746f8127..b1861f6dd 100644
--- a/libempathy/empathy-ft-handler.c
+++ b/libempathy/empathy-ft-handler.c
@@ -419,6 +419,9 @@ ft_transfer_progress_callback (EmpathyTpFile *tp_file,
EmpathyFTHandler *handler = user_data;
EmpathyFTHandlerPriv *priv = GET_PRIV (handler);
+ if (empathy_ft_handler_is_cancelled (handler))
+ return;
+
if (transferred_bytes == 0)
{
priv->last_update_time = empathy_time_get_current ();
diff --git a/libempathy/empathy-tp-file.c b/libempathy/empathy-tp-file.c
index 0d276818b..03dfb7875 100644
--- a/libempathy/empathy-tp-file.c
+++ b/libempathy/empathy-tp-file.c
@@ -98,6 +98,8 @@ typedef struct {
EmpathyTpFileOperationCallback op_callback;
gpointer op_user_data;
+ gboolean is_closed;
+
gboolean dispose_run;
} EmpathyTpFilePriv;
@@ -160,6 +162,11 @@ ft_operation_close_clean (EmpathyTpFile *tp_file)
DEBUG ("FT operation close clean");
+ if (priv->is_closed)
+ return;
+ else
+ priv->is_closed = TRUE;
+
if (priv->op_callback)
priv->op_callback (tp_file, NULL, priv->op_user_data);
}
@@ -172,6 +179,11 @@ ft_operation_close_with_error (EmpathyTpFile *tp_file,
DEBUG ("FT operation close with error %s", error->message);
+ if (priv->is_closed)
+ return;
+ else
+ priv->is_closed = TRUE;
+
/* close the channel if it's not cancelled already */
if (priv->state != TP_FILE_TRANSFER_STATE_CANCELLED)
empathy_tp_file_cancel (tp_file);