[gimp/gimp-2-10] Issue #3134 - Deleting last layer of group not updating image



commit b8d94342ca3394c2cf93b9f6b1982323564ad819
Author: Ell <ell_se yahoo com>
Date:   Wed Mar 20 17:45:03 2019 -0400

    Issue #3134 - Deleting last layer of group not updating image
    
    In gimp_group_layer_get_size(), make sure to always set *width and
    *height, even when the group is empty, so that when the function is
    called through gimp_projectable_get_size() by the group's
    projection, the correct size is reported.  This makes sure we
    update the correct area when the group becomes empty.
    
    (cherry picked from commit a712308f20a216f98a03dbd60db0476aedfad2fe)

 app/core/gimpgrouplayer.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/app/core/gimpgrouplayer.c b/app/core/gimpgrouplayer.c
index 8dfd386101..ada2232068 100644
--- a/app/core/gimpgrouplayer.c
+++ b/app/core/gimpgrouplayer.c
@@ -455,6 +455,7 @@ gimp_group_layer_get_size (GimpViewable *viewable,
                            gint         *height)
 {
   GimpGroupLayerPrivate *private = GET_PRIVATE (viewable);
+  gboolean               result;
 
   if (private->reallocate_width  != 0 &&
       private->reallocate_height != 0)
@@ -465,13 +466,18 @@ gimp_group_layer_get_size (GimpViewable *viewable,
       return TRUE;
     }
 
-  /*  return the size only if there are children...  */
-  if (gimp_item_stack_get_item_iter (GIMP_ITEM_STACK (private->children)))
-    return GIMP_VIEWABLE_CLASS (parent_class)->get_size (viewable,
+  result = GIMP_VIEWABLE_CLASS (parent_class)->get_size (viewable,
                                                          width, height);
 
-  /*  ...otherwise return "no content"  */
-  return FALSE;
+  /* if the group is empty, return "no content" through
+   * gimp_viewable_get_size(), but make sure to set *width and *height anyway,
+   * so that the correct size is reported to the projection through
+   * gimp_projectable_get_size().  see issue #3134.
+   */
+  if (gimp_container_is_empty (private->children))
+    result = FALSE;
+
+  return result;
 }
 
 static GimpContainer *


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