mirror of https://github.com/GNOME/gimp.git
Made the undo system robust against the currently pushed undo being too
2004-07-07 Michael Natterer <mitch@gimp.org> Made the undo system robust against the currently pushed undo being too large according to prefs settings. Fixes bug #145379. * app/core/gimpimage-undo.[ch] (gimp_image_undo_push_undo) (gimp_image_undo_group_end): emit "undo-event" *before* calling gimp_image_undo_free_space() so the undo history doesn't try to remove an item that has never been added. (gimp_image_undo_push_undo): added boolean return value indicating if the undo could be pushed (FALSE means the undo was to large and was discarded right away). (gimp_image_undo_push_item): return NULL if the above returned FALSE. * app/core/gimpimage-undo-push.c (gimp_image_undo_push_text_layer): changed accordingly.
This commit is contained in:
parent
59736893ab
commit
525a98f81a
20
ChangeLog
20
ChangeLog
|
@ -1,3 +1,23 @@
|
||||||
|
2004-07-07 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
|
Made the undo system robust against the currently pushed undo
|
||||||
|
being too large according to prefs settings. Fixes bug #145379.
|
||||||
|
|
||||||
|
* app/core/gimpimage-undo.[ch] (gimp_image_undo_push_undo)
|
||||||
|
(gimp_image_undo_group_end): emit "undo-event" *before* calling
|
||||||
|
gimp_image_undo_free_space() so the undo history doesn't try to
|
||||||
|
remove an item that has never been added.
|
||||||
|
|
||||||
|
(gimp_image_undo_push_undo): added boolean return value indicating
|
||||||
|
if the undo could be pushed (FALSE means the undo was to large
|
||||||
|
and was discarded right away).
|
||||||
|
|
||||||
|
(gimp_image_undo_push_item): return NULL if the above returned
|
||||||
|
FALSE.
|
||||||
|
|
||||||
|
* app/core/gimpimage-undo-push.c (gimp_image_undo_push_text_layer):
|
||||||
|
changed accordingly.
|
||||||
|
|
||||||
2004-07-07 Manish Singh <yosh@gimp.org>
|
2004-07-07 Manish Singh <yosh@gimp.org>
|
||||||
|
|
||||||
* plug-ins/common/jpeg.c: Don't try to load EXIF data if any warnings
|
* plug-ins/common/jpeg.c: Don't try to load EXIF data if any warnings
|
||||||
|
|
|
@ -1762,9 +1762,7 @@ gimp_image_undo_push_text_layer (GimpImage *gimage,
|
||||||
|
|
||||||
undo = gimp_text_undo_new (layer, pspec, undo_desc);
|
undo = gimp_text_undo_new (layer, pspec, undo_desc);
|
||||||
|
|
||||||
gimp_image_undo_push_undo (gimage, undo);
|
return gimp_image_undo_push_undo (gimage, undo);
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -170,13 +170,13 @@ gimp_image_undo_group_end (GimpImage *gimage)
|
||||||
{
|
{
|
||||||
gimage->pushing_undo_group = GIMP_UNDO_GROUP_NONE;
|
gimage->pushing_undo_group = GIMP_UNDO_GROUP_NONE;
|
||||||
|
|
||||||
gimp_image_undo_free_space (gimage);
|
|
||||||
|
|
||||||
/* Do it here, since undo_push doesn't emit this event while in
|
/* Do it here, since undo_push doesn't emit this event while in
|
||||||
* the middle of a group
|
* the middle of a group
|
||||||
*/
|
*/
|
||||||
gimp_image_undo_event (gimage, GIMP_UNDO_EVENT_UNDO_PUSHED,
|
gimp_image_undo_event (gimage, GIMP_UNDO_EVENT_UNDO_PUSHED,
|
||||||
gimp_undo_stack_peek (gimage->undo_stack));
|
gimp_undo_stack_peek (gimage->undo_stack));
|
||||||
|
|
||||||
|
gimp_image_undo_free_space (gimage);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -245,19 +245,20 @@ gimp_image_undo_push_item (GimpImage *gimage,
|
||||||
pop_func, free_func);
|
pop_func, free_func);
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_image_undo_push_undo (gimage, undo);
|
if (gimp_image_undo_push_undo (gimage, undo))
|
||||||
|
return undo;
|
||||||
|
|
||||||
return undo;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
gboolean
|
||||||
gimp_image_undo_push_undo (GimpImage *gimage,
|
gimp_image_undo_push_undo (GimpImage *gimage,
|
||||||
GimpUndo *undo)
|
GimpUndo *undo)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GIMP_IS_IMAGE (gimage));
|
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
|
||||||
g_return_if_fail (GIMP_IS_UNDO (undo));
|
g_return_val_if_fail (GIMP_IS_UNDO (undo), FALSE);
|
||||||
g_return_if_fail (undo->gimage == gimage);
|
g_return_val_if_fail (undo->gimage == gimage, FALSE);
|
||||||
g_return_if_fail (gimage->undo_freeze_count == 0);
|
g_return_val_if_fail (gimage->undo_freeze_count == 0, FALSE);
|
||||||
|
|
||||||
/* nuke the redo stack */
|
/* nuke the redo stack */
|
||||||
gimp_image_undo_free_redo (gimage);
|
gimp_image_undo_free_redo (gimage);
|
||||||
|
@ -275,9 +276,13 @@ gimp_image_undo_push_undo (GimpImage *gimage,
|
||||||
{
|
{
|
||||||
gimp_undo_stack_push_undo (gimage->undo_stack, undo);
|
gimp_undo_stack_push_undo (gimage->undo_stack, undo);
|
||||||
|
|
||||||
|
gimp_image_undo_event (gimage, GIMP_UNDO_EVENT_UNDO_PUSHED, undo);
|
||||||
|
|
||||||
gimp_image_undo_free_space (gimage);
|
gimp_image_undo_free_space (gimage);
|
||||||
|
|
||||||
gimp_image_undo_event (gimage, GIMP_UNDO_EVENT_UNDO_PUSHED, undo);
|
/* freeing undo space may have freed the newly pushed undo */
|
||||||
|
if (gimp_undo_stack_peek (gimage->undo_stack) == undo)
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -286,7 +291,11 @@ gimp_image_undo_push_undo (GimpImage *gimage,
|
||||||
undo_group = GIMP_UNDO_STACK (gimp_undo_stack_peek (gimage->undo_stack));
|
undo_group = GIMP_UNDO_STACK (gimp_undo_stack_peek (gimage->undo_stack));
|
||||||
|
|
||||||
gimp_undo_stack_push_undo (undo_group, undo);
|
gimp_undo_stack_push_undo (undo_group, undo);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ GimpUndo * gimp_image_undo_push_item (GimpImage *gimage,
|
||||||
gboolean dirties_image,
|
gboolean dirties_image,
|
||||||
GimpUndoPopFunc pop_func,
|
GimpUndoPopFunc pop_func,
|
||||||
GimpUndoFreeFunc free_func);
|
GimpUndoFreeFunc free_func);
|
||||||
void gimp_image_undo_push_undo (GimpImage *gimage,
|
gboolean gimp_image_undo_push_undo (GimpImage *gimage,
|
||||||
GimpUndo *undo);
|
GimpUndo *undo);
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue