[gthumb] async-task: make sure no other timeout is added



commit 25fdb3497156dd358f21984af8eae3f93d36e008
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sat Aug 28 17:54:16 2010 +0200

    async-task: make sure no other timeout is added

 gthumb/gth-async-task.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/gthumb/gth-async-task.c b/gthumb/gth-async-task.c
index 3c173f8..749edbc 100644
--- a/gthumb/gth-async-task.c
+++ b/gthumb/gth-async-task.c
@@ -20,6 +20,7 @@
  */
 
 #include <glib.h>
+#include "glib-utils.h"
 #include "gth-async-task.h"
 #include "typedefs.h"
 
@@ -70,6 +71,14 @@ gth_async_task_finalize (GObject *object)
 }
 
 
+static void
+task_completed (GError  *error,
+		gpointer user_data)
+{
+	gth_task_completed (GTH_TASK (user_data), error);
+}
+
+
 static gboolean
 update_progress (gpointer data)
 {
@@ -95,7 +104,8 @@ update_progress (gpointer data)
 
 		if (self->priv->after_func != NULL)
 			self->priv->after_func (error, self);
-		gth_task_completed (GTH_TASK (self), error);
+
+		ready_with_error (task_completed, self, error);
 
 		return FALSE;
 	}
@@ -141,7 +151,9 @@ gth_async_task_exec (GthTask *task)
 	if (self->priv->before_func != NULL)
 		self->priv->before_func (self);
 	g_thread_create (exec_task, self, FALSE, NULL);
-	self->priv->progress_event = g_timeout_add (PROGRESS_DELAY, update_progress, self);
+
+	if (self->priv->progress_event == 0)
+		self->priv->progress_event = g_timeout_add (PROGRESS_DELAY, update_progress, self);
 }
 
 



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