Using -maxundo causes segfault in Text widget
Closed / Fixed969358ffffffffffffffffffffffffffffffffffCreated 22 years agoUpdated 22 years ago
Descriptionplain2004-06-09 04:01:15
After setting the -maxundo option in the text widget, a
memory violation happens when number of undo
operations exceeds this maximum bound.
Using tcl 8.4.6 with memory debugging on, do this:
text .t -undo 1 -autoseparator 1 -maxundo 2
pack .t -expand 1 -fill both
.t insert end <some block of text>
1. select a portion of the text and do "Control-X"
2. do "Control-V" to paste back.
3. select another block of text an do "Control-X", the
program crashes.
The bug is in tkUndo.c, line 205. The loop to free undo
element is incorrect. Patch to fix is this:
Index: generic/tkUndo.c
==========================================
=========================
RCS
file: /home/cvs/starvine/cvsroot/tk/generic/tkUndo.c,v
retrieving revision 1.3
diff -u -r1.3 tkUndo.c
--- generic/tkUndo.c 9 Mar 2004 08:23:25 -0000
1.3
+++ generic/tkUndo.c 9 Jun 2004 03:52:01 -0000
@@ -205,7 +205,7 @@
while ( elem ) {
prevelem = elem;
elem = elem->next;
- ckfree((char *) elem);
+ ckfree((char *) prevelem);
}
stack->depth = stack->maxdepth;
}
dkf Ticket [969358ffff]: 1 change
[History diff]2004-06-10 02:20:27
dkfplain2004-06-10 02:20:28
Logged In: YES user_id=79902 Thanks for spotting this. Fixed in HEAD (though we could also do with a test, not that I could exhibit the bug in the first place due to memory manager differences; purifying would have caught this if it was triggered). Backport to 8.4 branch required.
dkf Ticket [969358ffff]: 1 change
[History diff]2004-06-10 02:20:54
hobbsplain2004-07-15 02:08:26
Logged In: YES user_id=72656 backported for 8.4.7.
Log in (anonymous is fine) to add a comment.