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



commit c7a5195bdf42aa194fed640943ada8d2114c4218
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.

 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 34e319e..5bae7d8 100644
--- a/app/tools/gimpfreeselecttool.c
+++ b/app/tools/gimpfreeselecttool.c
@@ -485,9 +485,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]