Bug 586008 - GIMP crashes when right-click canceling a drawing action initiated outside layer boundaries

(gimp_paint_core_cancel): don't pass out-of-drawable coordinates to
gimp_paint_core_copy_valid_tiles().
This commit is contained in:
Michael Natterer 2009-06-16 22:09:48 +02:00
parent 6049768abf
commit 06a3b3a85a
1 changed files with 16 additions and 8 deletions

View File

@ -490,6 +490,9 @@ void
gimp_paint_core_cancel (GimpPaintCore *core,
GimpDrawable *drawable)
{
gint x, y;
gint width, height;
g_return_if_fail (GIMP_IS_PAINT_CORE (core));
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
@ -500,11 +503,18 @@ gimp_paint_core_cancel (GimpPaintCore *core,
if ((core->x2 == core->x1) || (core->y2 == core->y1))
return;
gimp_paint_core_copy_valid_tiles (core->undo_tiles,
gimp_drawable_get_tiles (drawable),
core->x1, core->y1,
core->x2 - core->x1,
core->y2 - core->y1);
if (gimp_rectangle_intersect (core->x1, core->y1,
core->x2 - core->x1,
core->y2 - core->y1,
0, 0,
gimp_item_get_width (GIMP_ITEM (drawable)),
gimp_item_get_height (GIMP_ITEM (drawable)),
&x, &y, &width, &height))
{
gimp_paint_core_copy_valid_tiles (core->undo_tiles,
gimp_drawable_get_tiles (drawable),
x, y, width, height);
}
tile_manager_unref (core->undo_tiles);
core->undo_tiles = NULL;
@ -515,9 +525,7 @@ gimp_paint_core_cancel (GimpPaintCore *core,
core->saved_proj_tiles = NULL;
}
gimp_drawable_update (drawable,
core->x1, core->y1,
core->x2 - core->x1, core->y2 - core->y1);
gimp_drawable_update (drawable, x, y, width, height);
gimp_viewable_preview_thaw (GIMP_VIEWABLE (drawable));
}