mirror of https://github.com/GNOME/gimp.git
app/core/gimpimage.c fixed handling of the image undo counter for the case
2008-01-24 Sven Neumann <sven@gimp.org> * app/core/gimpimage.c * app/core/gimpimage-undo.c: fixed handling of the image undo counter for the case where the user has undone the image to a state before the last save and then pushes a new undo. Fixes bug #509822. svn path=/trunk/; revision=24699
This commit is contained in:
parent
fdc4eded22
commit
a9b946e376
|
@ -1,3 +1,11 @@
|
|||
2008-01-24 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/core/gimpimage.c
|
||||
* app/core/gimpimage-undo.c: fixed handling of the image undo
|
||||
counter for the case where the user has undone the image to a
|
||||
state before the last save and then pushes a new undo. Fixes
|
||||
bug #509822.
|
||||
|
||||
2008-01-24 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/gegl/gimpcolorizeconfig.[ch]: added reset() and to_cruft()
|
||||
|
|
|
@ -150,11 +150,10 @@ gimp_image_undo_free (GimpImage *image)
|
|||
/* If the image was dirty, but could become clean by redo-ing
|
||||
* some actions, then it should now become 'infinitely' dirty.
|
||||
* This is because we've just nuked the actions that would allow
|
||||
* the image to become clean again. The only hope for salvation
|
||||
* is to save the image now! -- austin
|
||||
* the image to become clean again.
|
||||
*/
|
||||
if (image->dirty < 0)
|
||||
image->dirty = 10000;
|
||||
image->dirty = 100000;
|
||||
|
||||
/* The same applies to the case where the image would become clean
|
||||
* due to undo actions, but since user can't undo without an undo
|
||||
|
@ -195,15 +194,6 @@ gimp_image_undo_group_start (GimpImage *image,
|
|||
/* nuke the redo stack */
|
||||
gimp_image_undo_free_redo (image);
|
||||
|
||||
/* If the image was dirty, but could become clean by redo-ing
|
||||
* some actions, then it should now become 'infinitely' dirty.
|
||||
* This is because we've just nuked the actions that would allow
|
||||
* the image to become clean again. The only hope for salvation
|
||||
* is to save the image now! -- austin
|
||||
*/
|
||||
if (image->dirty < 0)
|
||||
image->dirty = 10000;
|
||||
|
||||
undo_group = gimp_undo_stack_new (image);
|
||||
|
||||
gimp_object_set_name (GIMP_OBJECT (undo_group), name);
|
||||
|
@ -246,11 +236,11 @@ gimp_image_undo_group_end (GimpImage *image)
|
|||
}
|
||||
|
||||
GimpUndo *
|
||||
gimp_image_undo_push (GimpImage *image,
|
||||
GType object_type,
|
||||
GimpUndoType undo_type,
|
||||
const gchar *name,
|
||||
GimpDirtyMask dirty_mask,
|
||||
gimp_image_undo_push (GimpImage *image,
|
||||
GType object_type,
|
||||
GimpUndoType undo_type,
|
||||
const gchar *name,
|
||||
GimpDirtyMask dirty_mask,
|
||||
...)
|
||||
{
|
||||
GParameter *params = NULL;
|
||||
|
@ -292,15 +282,6 @@ gimp_image_undo_push (GimpImage *image,
|
|||
/* nuke the redo stack */
|
||||
gimp_image_undo_free_redo (image);
|
||||
|
||||
/* If the image was dirty, but could become clean by redo-ing
|
||||
* some actions, then it should now become 'infinitely' dirty.
|
||||
* This is because we've just nuked the actions that would allow
|
||||
* the image to become clean again. The only hope for salvation
|
||||
* is to save the image now! -- austin
|
||||
*/
|
||||
if (image->dirty < 0)
|
||||
image->dirty = 10000;
|
||||
|
||||
if (image->pushing_undo_group == GIMP_UNDO_GROUP_NONE)
|
||||
{
|
||||
gimp_undo_stack_push_undo (image->undo_stack, undo);
|
||||
|
@ -473,9 +454,7 @@ gimp_image_undo_free_space (GimpImage *image)
|
|||
static void
|
||||
gimp_image_undo_free_redo (GimpImage *image)
|
||||
{
|
||||
GimpContainer *container;
|
||||
|
||||
container = image->redo_stack->undos;
|
||||
GimpContainer *container = image->redo_stack->undos;
|
||||
|
||||
#ifdef DEBUG_IMAGE_UNDO
|
||||
g_printerr ("redo_steps: %d redo_bytes: %ld\n",
|
||||
|
@ -483,6 +462,9 @@ gimp_image_undo_free_redo (GimpImage *image)
|
|||
(glong) gimp_object_get_memsize (GIMP_OBJECT (container), NULL));
|
||||
#endif
|
||||
|
||||
if (gimp_container_is_empty (container))
|
||||
return;
|
||||
|
||||
while (gimp_container_num_children (container) > 0)
|
||||
{
|
||||
GimpUndo *freed = gimp_undo_stack_free_bottom (image->redo_stack,
|
||||
|
@ -499,6 +481,19 @@ gimp_image_undo_free_redo (GimpImage *image)
|
|||
|
||||
g_object_unref (freed);
|
||||
}
|
||||
|
||||
/* We need to use <= here because the undo counter has already been
|
||||
* incremented at this point.
|
||||
*/
|
||||
if (image->dirty <= 0)
|
||||
{
|
||||
/* If the image was dirty, but could become clean by redo-ing
|
||||
* some actions, then it should now become 'infinitely' dirty.
|
||||
* This is because we've just nuked the actions that would allow
|
||||
* the image to become clean again.
|
||||
*/
|
||||
image->dirty = 100000;
|
||||
}
|
||||
}
|
||||
|
||||
static GimpDirtyMask
|
||||
|
|
|
@ -1912,11 +1912,11 @@ gimp_image_undo_event (GimpImage *image,
|
|||
*
|
||||
* The image is dirty (ie, needs saving) if counter is non-zero.
|
||||
*
|
||||
* If the counter is around 10000, this is due to undo-ing back
|
||||
* before a saved version, then mutating the image (thus destroying
|
||||
* If the counter is around 100000, this is due to undo-ing back
|
||||
* before a saved version, then changing the image (thus destroying
|
||||
* the redo stack). Once this has happened, it's impossible to get
|
||||
* the image back to the state on disk, since the redo info has been
|
||||
* freed. See undo.c for the gorey details.
|
||||
* freed. See gimpimage-undo.c for the gory details.
|
||||
*/
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue