summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <dkf@noemail.net>2006-03-20 22:16:31 (GMT)
committerdkf <dkf@noemail.net>2006-03-20 22:16:31 (GMT)
commit799c5b90346732ebdbd14ab41eb8f1881463604e (patch)
treed326cfc66dfb93b230a68bcd1dd7d63a6a987c76
parent8f5cff9218a8d6c1cc6a8a7844dc273cedbfb1bb (diff)
downloadtk-799c5b90346732ebdbd14ab41eb8f1881463604e.zip
tk-799c5b90346732ebdbd14ab41eb8f1881463604e.tar.gz
tk-799c5b90346732ebdbd14ab41eb8f1881463604e.tar.bz2
Fix [Bug 1380427] with [Patch 1391939]
FossilOrigin-Name: 61de9f7a184adc733c3d68691f77e0b9611933eb
-rw-r--r--ChangeLog12
-rw-r--r--generic/tkUndo.c36
2 files changed, 17 insertions, 31 deletions
diff --git a/ChangeLog b/ChangeLog
index 0520942..00d6421 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,15 @@
+2006-03-20 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * generic/tkUndo.c (TkUndoSetDepth): Fix a crash in the undo stack
+ code. [Bug 1380427, Patch 1391939] Thanks to <lz_ufo@tin.it> for
+ reporting and Ludwig Callewaert for the fix.
+
2006-03-17 Pat Thoyts <patthoyts@users.sourceforge.net>
* library/clrpick.tcl: bug #1451587: avoid using abbreviated
- * library/palette.tcl: sub-commands in core scripts as this
- * library/scale.tcl: can cause problems with mega-widget
- * library/scrlbar.tcl: libraries like snit.
+ * library/palette.tcl: sub-commands in core scripts as this can
+ * library/scale.tcl: cause problems with mega-widget libraries
+ * library/scrlbar.tcl: like snit.
* library/tkfbox.tcl:
* library/xmfbox.tcl:
diff --git a/generic/tkUndo.c b/generic/tkUndo.c
index c860021..cbb3fac 100644
--- a/generic/tkUndo.c
+++ b/generic/tkUndo.c
@@ -8,7 +8,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.1.4.1 2004/07/14 19:07:48 hobbs Exp $
+ * RCS: @(#) $Id: tkUndo.c,v 1.1.4.2 2006/03/20 22:16:34 dkf Exp $
*/
#include "tkUndo.h"
@@ -190,12 +190,15 @@ void TkUndoSetDepth ( stack, maxdepth )
stack->maxdepth = maxdepth;
if ((stack->maxdepth > 0) && (stack->depth > stack->maxdepth)) {
- /* Maximum stack depth exceeded. We have to remove the last compound
- elements on the stack */
+ /*
+ * Maximum stack depth exceeded. We have to remove the last compound
+ * elements on the stack.
+ */
+
elem = stack->undoStack;
prevelem = NULL;
- while ( sepNumber <= stack->maxdepth ) {
- if (elem != NULL && (elem->type == TK_UNDO_SEPARATOR) ) {
+ while (elem && (sepNumber <= stack->maxdepth)) {
+ if (elem->type == TK_UNDO_SEPARATOR) {
sepNumber++;
}
prevelem = elem;
@@ -268,32 +271,9 @@ void TkUndoFreeStack ( stack )
void TkUndoInsertUndoSeparator ( stack )
TkUndoRedoStack * stack;
{
-/* TkUndoAtom * elem;
- TkUndoAtom * prevelem;
- int sepNumber = 0;
-*/
-
if ( TkUndoInsertSeparator(&(stack->undoStack)) ) {
++(stack->depth);
TkUndoSetDepth(stack,stack->maxdepth);
-/* 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;
- } */
}
}