[gimp] Bug 787848 - Duplicate image crashes if there is an empty layer group



commit 6dfe04e9283f8435979758ac7a1519481bc73694
Author: Michael Natterer <mitch gimp org>
Date:   Mon Sep 18 20:31:21 2017 +0200

    Bug 787848 - Duplicate image crashes if there is an empty layer group
    
    An empty gorup layer has no extent, so we fake its extents to be at
    least 1x1 whenever its projection is being recreated, because we can't
    have a 0x0 buffer in a drawable. This safeguard was forgotten in
    gimp_group_layer_convert_type() which gets called on image duplicate.

 app/core/gimpgrouplayer.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/app/core/gimpgrouplayer.c b/app/core/gimpgrouplayer.c
index 87ffe98..5aac2bd 100644
--- a/app/core/gimpgrouplayer.c
+++ b/app/core/gimpgrouplayer.c
@@ -876,6 +876,12 @@ gimp_group_layer_convert_type (GimpLayer        *layer,
       gimp_image_undo_push_group_layer_convert (image, NULL, group);
     }
 
+  /*  Force allocation of a same-size projection, in case the group
+   *  layer is empty
+   */
+  private->reallocate_width  = gimp_item_get_width  (GIMP_ITEM (group));
+  private->reallocate_height = gimp_item_get_height (GIMP_ITEM (group));
+
   /*  Need to temporarily set the projectable's format to the new
    *  values so the projection will create its tiles with the right
    *  depth
@@ -897,6 +903,9 @@ gimp_group_layer_convert_type (GimpLayer        *layer,
 
   /*  reset, the actual format is right now  */
   private->convert_format = NULL;
+
+  private->reallocate_width  = 0;
+  private->reallocate_height = 0;
 }
 
 static GeglNode *


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