[gimp] app: cancel async histogram calculation in gimp_histogram_clear_values()



commit d5b0b084319974f8b1b27cbac81cc813d047e0fb
Author: Ell <ell_se yahoo com>
Date:   Sat May 12 08:56:16 2018 -0400

    app: cancel async histogram calculation in gimp_histogram_clear_values()
    
    Cancel any on-going asynchronous histogram calculation, started
    through gimp_histogram_calculate_async(), upon calling
    gimp_histogram_clear_values().

 app/core/gimphistogram.c |   22 ++++++----------------
 1 files changed, 6 insertions(+), 16 deletions(-)
---
diff --git a/app/core/gimphistogram.c b/app/core/gimphistogram.c
index 4314d50..4804e2b 100644
--- a/app/core/gimphistogram.c
+++ b/app/core/gimphistogram.c
@@ -69,7 +69,6 @@ typedef struct
 
 /*  local function prototypes  */
 
-static void      gimp_histogram_dispose                  (GObject             *object);
 static void      gimp_histogram_finalize                 (GObject             *object);
 static void      gimp_histogram_set_property             (GObject             *object,
                                                           guint                property_id,
@@ -108,7 +107,6 @@ gimp_histogram_class_init (GimpHistogramClass *klass)
   GObjectClass      *object_class      = G_OBJECT_CLASS (klass);
   GimpObjectClass   *gimp_object_class = GIMP_OBJECT_CLASS (klass);
 
-  object_class->dispose          = gimp_histogram_dispose;
   object_class->finalize         = gimp_histogram_finalize;
   object_class->set_property     = gimp_histogram_set_property;
   object_class->get_property     = gimp_histogram_get_property;
@@ -145,20 +143,6 @@ gimp_histogram_init (GimpHistogram *histogram)
 }
 
 static void
-gimp_histogram_dispose (GObject *object)
-{
-  GimpHistogram *histogram = GIMP_HISTOGRAM (object);
-
-  if (histogram->priv->calculate_async)
-    {
-      gimp_async_cancel (histogram->priv->calculate_async);
-      gimp_async_wait (histogram->priv->calculate_async);
-    }
-
-  G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
 gimp_histogram_finalize (GObject *object)
 {
   GimpHistogram *histogram = GIMP_HISTOGRAM (object);
@@ -369,6 +353,12 @@ gimp_histogram_clear_values (GimpHistogram *histogram)
 {
   g_return_if_fail (GIMP_IS_HISTOGRAM (histogram));
 
+  if (histogram->priv->calculate_async)
+    {
+      gimp_async_cancel (histogram->priv->calculate_async);
+      gimp_async_wait (histogram->priv->calculate_async);
+    }
+
   if (histogram->priv->values)
     {
       g_free (histogram->priv->values);


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