Commit f9e68fe0 authored by Michael Natterer's avatar Michael Natterer 😴

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.
parent 8688037a
......@@ -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);
......
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment