mirror of https://github.com/GNOME/gimp.git
Issue #2272 - Crash when using the intelligent-scissors tool ...
... after erasing all points When erasing the last remaining point in the iscissors tool, halt the tool, rather than leaving the tool active with an empty curve, which it is not prepared to handle, and which results in a segfault once trying to add a new point. Additionally, when erasing the last remaining segment (i.e., the two last remaining points), don't erase the entire segment (i.e., both points), but rather convert the segment to its initial point, so that, in effect, we only erase the last point of the segment.
This commit is contained in:
parent
53964dcb92
commit
a5baba5539
|
@ -1074,15 +1074,36 @@ gimp_iscissors_tool_key_press (GimpTool *tool,
|
||||||
case GDK_KEY_BackSpace:
|
case GDK_KEY_BackSpace:
|
||||||
if (! iscissors->curve->closed &&
|
if (! iscissors->curve->closed &&
|
||||||
g_queue_peek_tail (iscissors->curve->segments))
|
g_queue_peek_tail (iscissors->curve->segments))
|
||||||
|
{
|
||||||
|
ISegment *segment = g_queue_peek_tail (iscissors->curve->segments);
|
||||||
|
|
||||||
|
if (g_queue_get_length (iscissors->curve->segments) > 1)
|
||||||
{
|
{
|
||||||
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
|
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
|
||||||
|
|
||||||
gimp_iscissors_tool_push_undo (iscissors);
|
gimp_iscissors_tool_push_undo (iscissors);
|
||||||
icurve_delete_segment (iscissors->curve,
|
icurve_delete_segment (iscissors->curve, segment);
|
||||||
g_queue_peek_tail (iscissors->curve->segments));
|
|
||||||
gimp_iscissors_tool_free_redo (iscissors);
|
gimp_iscissors_tool_free_redo (iscissors);
|
||||||
|
|
||||||
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
|
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
|
||||||
|
}
|
||||||
|
else if (segment->x2 != segment->x1 || segment->y2 != segment->y1)
|
||||||
|
{
|
||||||
|
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
|
||||||
|
|
||||||
|
gimp_iscissors_tool_push_undo (iscissors);
|
||||||
|
segment->x2 = segment->x1;
|
||||||
|
segment->y2 = segment->y1;
|
||||||
|
g_ptr_array_remove_range (segment->points,
|
||||||
|
0, segment->points->len);
|
||||||
|
gimp_iscissors_tool_free_redo (iscissors);
|
||||||
|
|
||||||
|
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gimp_tool_control (tool, GIMP_TOOL_ACTION_HALT, display);
|
||||||
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
Loading…
Reference in New Issue