[gimp/gimp-2-6] Bug 604078 - Crash when pressing Backspace with Free Select Tool



commit 46c91ebc2fead486b2b8849bacb7d91085c5aad6
Author: Martin Nordholts <martinn src gnome org>
Date:   Tue Dec 8 22:27:32 2009 +0100

    Bug 604078 - Crash when pressing Backspace with Free Select Tool
    
    Make sure we never call gimp_free_select_tool_remove_last_segment()
    with priv->n_segment_indices being negative, and increase robustness
    of the code in general.
    
    Note that we always halt the tool when backspace is pressed and there
    are no vertices left. This is to minimize the risk of ending up in an
    invalid tool state.
    (cherry picked from commit c7a5195bdf42aa194fed640943ada8d2114c4218)

 app/tools/gimpfreeselecttool.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/app/tools/gimpfreeselecttool.c b/app/tools/gimpfreeselecttool.c
index 3549caf..6051100 100644
--- a/app/tools/gimpfreeselecttool.c
+++ b/app/tools/gimpfreeselecttool.c
@@ -484,9 +484,10 @@ gimp_free_select_tool_remove_last_segment (GimpFreeSelectTool *fst)
 
   gimp_draw_tool_pause (draw_tool);
 
-  priv->n_segment_indices--;
+  if (priv->n_segment_indices > 0)
+    priv->n_segment_indices--;
 
-  if (priv->n_segment_indices == 0)
+  if (priv->n_segment_indices <= 0)
     {
       gimp_free_select_tool_halt (fst);
     }



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