[gimp] Bug 793373 - Crash when ctrl-alt-clicking, dragging then releasing...



commit d9987ea7f13b22237e745b661713d6b47a477abf
Author: Jehan <jehan girinstud io>
Date:   Mon Feb 12 08:23:05 2018 +0100

    Bug 793373 - Crash when ctrl-alt-clicking, dragging then releasing...
    
    ... a selection.
    The regression appeared with commit 10c125c627.
    gimp_layer_end_move() may sometimes run even while a symmetric
    gimp_layer_start_move() had not run. For instance this happens when
    releasing the mouse button after dragging a ctrl-alt-click created
    floating layer.
    Therefore let's check that layer->move_stack is not NULL before
    dereferencing it.

 app/core/gimplayer.c |   28 ++++++++++++++++------------
 1 files changed, 16 insertions(+), 12 deletions(-)
---
diff --git a/app/core/gimplayer.c b/app/core/gimplayer.c
index 9939169..94783b9 100644
--- a/app/core/gimplayer.c
+++ b/app/core/gimplayer.c
@@ -1090,27 +1090,31 @@ gimp_layer_end_move (GimpItem *item,
                      gboolean  push_undo)
 {
   GimpLayer *layer = GIMP_LAYER (item);
-  GSList    *ancestors;
-  GSList    *iter;
 
   if (GIMP_ITEM_CLASS (parent_class)->end_move)
     GIMP_ITEM_CLASS (parent_class)->end_move (item, push_undo);
 
-  ancestors = layer->move_stack->data;
+  if (layer->move_stack)
+    {
+      GSList *ancestors;
+      GSList *iter;
 
-  layer->move_stack = g_slist_remove (layer->move_stack, ancestors);
+      ancestors = layer->move_stack->data;
 
-  /* resume mask cropping for all of the layer's ancestors */
-  for (iter = ancestors; iter; iter = g_slist_next (iter))
-    {
-      GimpGroupLayer *ancestor = iter->data;
+      layer->move_stack = g_slist_remove (layer->move_stack, ancestors);
 
-      gimp_group_layer_resume_mask (ancestor, push_undo);
+      /* resume mask cropping for all of the layer's ancestors */
+      for (iter = ancestors; iter; iter = g_slist_next (iter))
+        {
+          GimpGroupLayer *ancestor = iter->data;
 
-      g_object_unref (ancestor);
-    }
+          gimp_group_layer_resume_mask (ancestor, push_undo);
 
-  g_slist_free (ancestors);
+          g_object_unref (ancestor);
+        }
+
+      g_slist_free (ancestors);
+    }
 }
 
 static void


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