diff options
author | mdejong <mdejong> | 2005-01-19 22:09:58 (GMT) |
---|---|---|
committer | mdejong <mdejong> | 2005-01-19 22:09:58 (GMT) |
commit | da5de727039ef8427cdb630db9e7e0827a9eaf2f (patch) | |
tree | 1c665c7ebe145a9fb560b068b384c4a17addd392 /win | |
parent | 880a82c45c8206874e5039321ae19a265918f8b8 (diff) | |
download | tcl-da5de727039ef8427cdb630db9e7e0827a9eaf2f.zip tcl-da5de727039ef8427cdb630db9e7e0827a9eaf2f.tar.gz tcl-da5de727039ef8427cdb630db9e7e0827a9eaf2f.tar.bz2 |
* win/tclWinChan.c (FileCloseProc): Invoke
TclpCutFileChannel() to remove a FileInfo from
the thread local list before deallocating it.
This should have been done via an earlier
call to Tcl_CutChannel, but I was running into
a crash in the next call to Tcl_CutChannel
during the IO finalization stage.
Diffstat (limited to 'win')
-rw-r--r-- | win/tclWinChan.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/win/tclWinChan.c b/win/tclWinChan.c index 60f9aef..9333726 100644 --- a/win/tclWinChan.c +++ b/win/tclWinChan.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: tclWinChan.c,v 1.30.2.1 2004/06/21 22:07:32 mdejong Exp $ + * RCS: @(#) $Id: tclWinChan.c,v 1.30.2.2 2005/01/19 22:09:58 mdejong Exp $ */ #include "tclWinInt.h" @@ -401,6 +401,8 @@ FileCloseProc(instanceData, interp) Tcl_Interp *interp; /* Not used. */ { FileInfo *fileInfoPtr = (FileInfo *) instanceData; + FileInfo *infoPtr; + ThreadSpecificData *tsdPtr; int errorCode = 0; /* @@ -425,6 +427,23 @@ FileCloseProc(instanceData, interp) } } + /* + * See if this FileInfo* is still on the thread local list. + */ + tsdPtr = TCL_TSD_INIT(&dataKey); + for (infoPtr = tsdPtr->firstFilePtr; infoPtr != NULL; + infoPtr = infoPtr->nextPtr) { + if (infoPtr == fileInfoPtr) { + /* + * This channel exists on the thread local list. It should + * have been removed by an earlier call to TclpCutFileChannel, + * but do that now since just deallocating fileInfoPtr would + * leave an deallocated pointer on the thread local list. + */ + TclpCutFileChannel(fileInfoPtr->channel); + break; + } + } ckfree((char *)fileInfoPtr); return errorCode; } |