summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2005-12-28 17:26:22 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2005-12-28 17:26:22 (GMT)
commit06ffd70d497e92ae700dd2154b27e65bdcf1d3a2 (patch)
tree229f1b4f735bb4f54a84c65f5b871fe0a688e543 /generic
parent8dddd682ecedf0874a552e8c4e2e6fa661fc8fbc (diff)
downloadtk-06ffd70d497e92ae700dd2154b27e65bdcf1d3a2.zip
tk-06ffd70d497e92ae700dd2154b27e65bdcf1d3a2.tar.gz
tk-06ffd70d497e92ae700dd2154b27e65bdcf1d3a2.tar.bz2
Fix [Bug 1380427] using [Patch 1391939] from Ludwig Callewaert
Diffstat (limited to 'generic')
-rw-r--r--generic/tkUndo.c39
1 files changed, 7 insertions, 32 deletions
diff --git a/generic/tkUndo.c b/generic/tkUndo.c
index 76046f8..db6a5a8 100644
--- a/generic/tkUndo.c
+++ b/generic/tkUndo.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkUndo.c,v 1.8 2005/11/17 16:21:56 dkf Exp $
+ * RCS: @(#) $Id: tkUndo.c,v 1.9 2005/12/28 17:26:22 dkf Exp $
*/
#include "tkUndo.h"
@@ -373,12 +373,12 @@ TkUndoSetDepth(
TkUndoRedoStack *stack, /* An Undo/Redo stack */
int maxdepth) /* The maximum stack depth */
{
- TkUndoAtom *elem, *prevelem;
- int sepNumber = 0;
-
stack->maxdepth = maxdepth;
if (stack->maxdepth>0 && stack->depth>stack->maxdepth) {
+ TkUndoAtom *elem, *prevelem;
+ int sepNumber = 0;
+
/*
* Maximum stack depth exceeded. We have to remove the last compound
* elements on the stack.
@@ -386,8 +386,8 @@ TkUndoSetDepth(
elem = stack->undoStack;
prevelem = NULL;
- while (sepNumber <= stack->maxdepth) {
- if (elem != NULL && elem->type == TK_UNDO_SEPARATOR) {
+ while ((elem != NULL) && (sepNumber <= stack->maxdepth)) {
+ if (elem->type == TK_UNDO_SEPARATOR) {
sepNumber++;
}
prevelem = elem;
@@ -400,6 +400,7 @@ TkUndoSetDepth(
while (sub->next != NULL) {
TkUndoSubAtom *next = sub->next;
+
if (sub->action != NULL) {
Tcl_DecrRefCount(sub->action);
}
@@ -485,35 +486,9 @@ void
TkUndoInsertUndoSeparator(
TkUndoRedoStack *stack)
{
- /*
- * TkUndoAtom * elem;
- * TkUndoAtom * prevelem;
- * int sepNumber = 0;
- */
-
if (TkUndoInsertSeparator(&stack->undoStack)) {
stack->depth++;
TkUndoSetDepth(stack, stack->maxdepth);
-#ifdef OBSOLETE_OR_BUGGY_CODE
- if (stack->maxdepth>0 && stack->depth>stack->maxdepth) {
- elem = stack->undoStack;
- prevelem = NULL;
- while (sepNumber < stack->depth) {
- if (elem != NULL && elem->type == TK_UNDO_SEPARATOR) {
- sepNumber++;
- }
- prevelem = elem;
- elem = elem->next;
- }
- prevelem->next = NULL;
- while (elem) {
- prevelem = elem;
- elem = elem->next;
- ckfree((char *) elem);
- }
- stack->depth;
- }
-#endif /* OBSOLETE_OR_BUGGY_CODE */
}
}