[gthumb] async task: allow to unref the task in the after_func function



commit aa974c1e61bb800ec83392076aa4a8e81eb0d281
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Fri Jun 28 16:35:02 2013 +0200

    async task: allow to unref the task in the after_func function

 gthumb/gth-async-task.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/gthumb/gth-async-task.c b/gthumb/gth-async-task.c
index c7b0093..e0b752c 100644
--- a/gthumb/gth-async-task.c
+++ b/gthumb/gth-async-task.c
@@ -82,7 +82,10 @@ static void
 task_completed (GError  *error,
                gpointer user_data)
 {
-       gth_task_completed (GTH_TASK (user_data), error);
+       GthAsyncTask *self = user_data;
+
+       gth_task_completed (GTH_TASK (self), error);
+       g_object_unref (self);
 }
 
 
@@ -109,6 +112,8 @@ update_progress (gpointer data)
                if (cancelled)
                        error = g_error_new_literal (GTH_TASK_ERROR, GTH_TASK_ERROR_CANCELLED, "");
 
+               g_object_ref (self);
+
                if (self->priv->after_func != NULL)
                        self->priv->after_func (self, error, self->priv->user_data);
 


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