summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authora_kovalenko <a_kovalenko>2006-01-12 23:29:35 (GMT)
committera_kovalenko <a_kovalenko>2006-01-12 23:29:35 (GMT)
commit81f1e32f9fc5bd5badc575ff2410440382e87181 (patch)
tree3c2bd73848a8436bbe6a8793f8d30e0dafc577bf /generic
parent68f17ab967c493970c0fd1277ecf5abe9dd8e9a6 (diff)
downloadtk-81f1e32f9fc5bd5badc575ff2410440382e87181.zip
tk-81f1e32f9fc5bd5badc575ff2410440382e87181.tar.gz
tk-81f1e32f9fc5bd5badc575ff2410440382e87181.tar.bz2
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.
Diffstat (limited to 'generic')
-rw-r--r--generic/tkUndo.c32
1 files changed, 21 insertions, 11 deletions
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);
}