]> git.0d.be Git - empathy.git/commitdiff
Ensure the callbacks are only run once
authorCosimo Cecchi <cosimo.cecchi@collabora.co.uk>
Tue, 5 May 2009 15:42:23 +0000 (17:42 +0200)
committerCosimo Cecchi <cosimoc@gnome.org>
Mon, 1 Jun 2009 15:47:39 +0000 (17:47 +0200)
Also ensure that we get no progress callbacks after the transfer has
been cancelled.

libempathy/empathy-ft-handler.c
libempathy/empathy-tp-file.c

index 6746f81271063ceaf23cb54e2160013b247376e3..b1861f6ddfeca5d9c08155f060f40aeeed0001a7 100644 (file)
@@ -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 ();
index 0d276818b52abbf0c98a0f9f435e201b6f95be68..03dfb7875cdc3b4fc8e6755ee46f32e0076aa514 100644 (file)
@@ -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);