[gegl] color-enhance: avoid leaking a buffer-iterator



commit 0b8a4082857c13a2a6896f96e656701115140ed5
Author: Øyvind Kolås <pippin gimp org>
Date:   Fri May 24 13:54:41 2019 +0200

    color-enhance: avoid leaking a buffer-iterator
    
    This fixes issue #164, by with the first suggestion, avoiding even allocating
    it in the first place.

 operations/common/color-enhance.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/operations/common/color-enhance.c b/operations/common/color-enhance.c
index 3036eb143..95a1ef1ad 100644
--- a/operations/common/color-enhance.c
+++ b/operations/common/color-enhance.c
@@ -146,12 +146,6 @@ process (GeglOperation       *operation,
 
   gegl_operation_progress (operation, 0.5, "");
 
-  gi = gegl_buffer_iterator_new (input, result, 0, format,
-                                 GEGL_ACCESS_READ, GEGL_ABYSS_NONE, 2);
-
-  gegl_buffer_iterator_add (gi, output, result, 0, format,
-                            GEGL_ACCESS_WRITE, GEGL_ABYSS_NONE);
-
   delta = max - min;
 
   if (! delta)
@@ -161,6 +155,13 @@ process (GeglOperation       *operation,
       return TRUE;
     }
 
+  gi = gegl_buffer_iterator_new (input, result, 0, format,
+                                 GEGL_ACCESS_READ, GEGL_ABYSS_NONE, 2);
+
+  gegl_buffer_iterator_add (gi, output, result, 0, format,
+                            GEGL_ACCESS_WRITE, GEGL_ABYSS_NONE);
+
+
   if (has_alpha)
     {
       while (gegl_buffer_iterator_next (gi))


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