diff options
author | Kevin B Kenny <kennykb@acm.org> | 2003-02-15 20:24:09 (GMT) |
---|---|---|
committer | Kevin B Kenny <kennykb@acm.org> | 2003-02-15 20:24:09 (GMT) |
commit | c57a31dd4cb2115f456bd86670401d84cfece198 (patch) | |
tree | b5e5798c6c88c51e872ae25e983a8b464b8a4373 /generic/tclNotify.c | |
parent | d7fea62a694860b20556f09402fa119eb3bc4cdb (diff) | |
download | tcl-c57a31dd4cb2115f456bd86670401d84cfece198.zip tcl-c57a31dd4cb2115f456bd86670401d84cfece198.tar.gz tcl-c57a31dd4cb2115f456bd86670401d84cfece198.tar.bz2 |
Fixed Tcl_DeleteEvents not to get a pointer smash when deleting the
last event in the queue. Added test code in 'tcltest' and a new file
of test cases 'notify.test' to exercise this functionality; several of
the new test cases fail for the original code and pass for the
corrected code.
Diffstat (limited to 'generic/tclNotify.c')
-rw-r--r-- | generic/tclNotify.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/generic/tclNotify.c b/generic/tclNotify.c index a9bdebc..d312e6c 100644 --- a/generic/tclNotify.c +++ b/generic/tclNotify.c @@ -9,11 +9,12 @@ * * Copyright (c) 1995-1997 Sun Microsystems, Inc. * Copyright (c) 1998 by Scriptics Corporation. + * Copyright (c) 2003 by Kevin B. Kenny. All rights reserved. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclNotify.c,v 1.10 2002/12/17 21:35:56 hobbs Exp $ + * RCS: @(#) $Id: tclNotify.c,v 1.11 2003/02/15 20:24:10 kennykb Exp $ */ #include "tclInt.h" @@ -509,15 +510,15 @@ Tcl_DeleteEvents(proc, clientData) if ((*proc) (evPtr, clientData) == 1) { if (tsdPtr->firstEventPtr == evPtr) { tsdPtr->firstEventPtr = evPtr->nextPtr; - if (evPtr->nextPtr == (Tcl_Event *) NULL) { - tsdPtr->lastEventPtr = prevPtr; - } - if (tsdPtr->markerEventPtr == evPtr) { - tsdPtr->markerEventPtr = prevPtr; - } } else { prevPtr->nextPtr = evPtr->nextPtr; } + if (evPtr->nextPtr == (Tcl_Event *) NULL) { + tsdPtr->lastEventPtr = prevPtr; + } + if (tsdPtr->markerEventPtr == evPtr) { + tsdPtr->markerEventPtr = prevPtr; + } hold = evPtr; evPtr = evPtr->nextPtr; ckfree((char *) hold); |