Fix undo when going back from a modified text layer to an editable one

My earlier change to using gimp_drawable_push_undo() here was a very
bad idea. Go back to using gimp_image_undo_push_drawable_mod(), but
make use of its new tile-copying feature so the problem that made me
do the earlier change is fixed too. See comments in the changed code.
This commit is contained in:
Michael Natterer 2010-03-18 10:32:52 +01:00
parent 8688037a58
commit f9e68fe0ee
2 changed files with 14 additions and 10 deletions

View File

@ -460,11 +460,16 @@ gimp_text_layer_set (GimpTextLayer *layer,
if (layer->modified)
{
gimp_image_undo_push_text_layer_modified (image, NULL, layer);
gimp_drawable_push_undo (GIMP_DRAWABLE (layer), NULL,
0, 0,
gimp_item_get_width (GIMP_ITEM (layer)),
gimp_item_get_height (GIMP_ITEM (layer)),
NULL, FALSE);
/* pass copy_tiles = TRUE so we not only ref the tiles; after
* being a text layer again, undo doesn't care about the
* layer's pixels any longer because they are generated, so
* changing the text would happily overwrite the layer's
* pixels, changing the pixels on the undo stack too without
* any chance to ever undo again.
*/
gimp_image_undo_push_drawable_mod (image, NULL,
GIMP_DRAWABLE (layer), TRUE);
}
gimp_image_undo_push_text_layer (image, undo_desc, layer, NULL);

View File

@ -1239,11 +1239,10 @@ gimp_text_tool_apply (GimpTextTool *text_tool)
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_TEXT, NULL);
gimp_image_undo_push_text_layer_modified (image, NULL, layer);
gimp_drawable_push_undo (GIMP_DRAWABLE (layer), NULL,
0, 0,
gimp_item_get_width (GIMP_ITEM (layer)),
gimp_item_get_height (GIMP_ITEM (layer)),
NULL, FALSE);
/* see comment in gimp_text_layer_set() */
gimp_image_undo_push_drawable_mod (image, NULL,
GIMP_DRAWABLE (layer), TRUE);
}
gimp_image_undo_push_text_layer (image, NULL, layer, pspec);