diff options
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | generic/tkUndo.c | 32 |
2 files changed, 30 insertions, 11 deletions
@@ -1,3 +1,12 @@ +2006-01-13 Anton Kovalenko <a_kovalenko@users.sourceforge.net> + + * generic/tkUndo.c (TkUndoSetDepth): Don't free + TkUndoSubAtoms for separator entries that are deleted: + there is some unpredictable garbage instead of subatoms. + + Free both 'apply' and 'revert' action chains for + non-separator entries. + 2006-01-12 Donal K. Fellows <dkf@users.sf.net> TIP #260 IMPLEMENTATION diff --git a/generic/tkUndo.c b/generic/tkUndo.c index db6a5a8..27a31ce 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.9 2005/12/28 17:26:22 dkf Exp $ + * RCS: @(#) $Id: tkUndo.c,v 1.10 2006/01/12 23:29:36 a_kovalenko Exp $ */ #include "tkUndo.h" @@ -395,19 +395,29 @@ TkUndoSetDepth( } prevelem->next = NULL; while (elem != NULL) { - TkUndoSubAtom *sub = elem->apply; prevelem = elem; - - while (sub->next != NULL) { - TkUndoSubAtom *next = sub->next; - - if (sub->action != NULL) { - Tcl_DecrRefCount(sub->action); + if (elem->type != TK_UNDO_SEPARATOR) { + TkUndoSubAtom *sub = elem->apply; + while (sub->next != NULL) { + TkUndoSubAtom *next = sub->next; + + if (sub->action != NULL) { + Tcl_DecrRefCount(sub->action); + } + ckfree((char *)sub); + sub = next; + } + sub = elem->revert; + while (sub->next != NULL) { + TkUndoSubAtom *next = sub->next; + + if (sub->action != NULL) { + Tcl_DecrRefCount(sub->action); + } + ckfree((char *)sub); + sub = next; } - ckfree((char *)sub); - sub = next; } - elem = elem->next; ckfree((char *) prevelem); } |