[gimp] app: fix last fix for the region leak...



commit cfa17dc744ecfe3d6fc5be386c76e0762d4a3ee4
Author: Michael Natterer <mitch gimp org>
Date:   Sat Oct 2 21:52:42 2010 +0200

    app: fix last fix for the region leak...
    
    The fix was bogusly destroying a region that is still needed
    for the last end_change() if the change count is > 1.

 app/display/gimpcanvasitem.c |   44 +++++++++++++++++++++--------------------
 1 files changed, 23 insertions(+), 21 deletions(-)
---
diff --git a/app/display/gimpcanvasitem.c b/app/display/gimpcanvasitem.c
index e4a7fe4..ccd8246 100644
--- a/app/display/gimpcanvasitem.c
+++ b/app/display/gimpcanvasitem.c
@@ -469,34 +469,36 @@ gimp_canvas_item_end_change (GimpCanvasItem *item)
 
   private->change_count--;
 
-  if (private->change_count == 0 &&
-      g_signal_has_handler_pending (item, item_signals[UPDATE], 0, FALSE))
+  if (private->change_count == 0)
     {
-      GdkRegion *region = gimp_canvas_item_get_extents (item);
-
-      if (! region)
+      if (g_signal_has_handler_pending (item, item_signals[UPDATE], 0, FALSE))
         {
-          region = private->change_region;
+          GdkRegion *region = gimp_canvas_item_get_extents (item);
+
+          if (! region)
+            {
+              region = private->change_region;
+            }
+          else if (private->change_region)
+            {
+              gdk_region_union (region, private->change_region);
+              gdk_region_destroy (private->change_region);
+            }
+
+          private->change_region = NULL;
+
+          if (region)
+            {
+              g_signal_emit (item, item_signals[UPDATE], 0,
+                             region);
+              gdk_region_destroy (region);
+            }
         }
       else if (private->change_region)
         {
-          gdk_region_union (region, private->change_region);
           gdk_region_destroy (private->change_region);
+          private->change_region = NULL;
         }
-
-      private->change_region = NULL;
-
-      if (region)
-        {
-          g_signal_emit (item, item_signals[UPDATE], 0,
-                         region);
-          gdk_region_destroy (region);
-        }
-    }
-  else if (private->change_region)
-    {
-      gdk_region_destroy (private->change_region);
-      private->change_region = NULL;
     }
 }
 



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