diff options
| author | dgp@users.sourceforge.net <dgp> | 2012-10-03 15:29:59 (GMT) |
|---|---|---|
| committer | dgp@users.sourceforge.net <dgp> | 2012-10-03 15:29:59 (GMT) |
| commit | 3879f86ffc6bfe32b3b4a83343c8c26fb58d5e37 (patch) | |
| tree | f5a13906329fd2a415bdfe358595e2c98c74d00a /generic/tclIO.c | |
| parent | ad632b04c2a0515d3b9d5953106f0d64e63e14b0 (diff) | |
| parent | 6a27b355f25492d9603cfd7f30148fda8dba53c7 (diff) | |
| download | tcl-3879f86ffc6bfe32b3b4a83343c8c26fb58d5e37.zip tcl-3879f86ffc6bfe32b3b4a83343c8c26fb58d5e37.tar.gz tcl-3879f86ffc6bfe32b3b4a83343c8c26fb58d5e37.tar.bz2 | |
When checking for std channels being closed, compare the channel state,
not the channel itself so that stacked channels do not cause trouble.
Diffstat (limited to 'generic/tclIO.c')
| -rw-r--r-- | generic/tclIO.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c index eeca41b..e2415d8 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -748,21 +748,25 @@ CheckForStdChannelsBeingClosed( ChannelState *statePtr = ((Channel *) chan)->state; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - if ((chan == tsdPtr->stdinChannel) && (tsdPtr->stdinInitialized)) { + if (tsdPtr->stdinInitialized + && tsdPtr->stdinChannel != NULL + && statePtr == ((Channel *)tsdPtr->stdinChannel)->state) { if (statePtr->refCount < 2) { statePtr->refCount = 0; tsdPtr->stdinChannel = NULL; return; } - } else if ((chan == tsdPtr->stdoutChannel) - && (tsdPtr->stdoutInitialized)) { + } else if (tsdPtr->stdoutInitialized + && tsdPtr->stdoutChannel != NULL + && statePtr == ((Channel *)tsdPtr->stdoutChannel)->state) { if (statePtr->refCount < 2) { statePtr->refCount = 0; tsdPtr->stdoutChannel = NULL; return; } - } else if ((chan == tsdPtr->stderrChannel) - && (tsdPtr->stderrInitialized)) { + } else if (tsdPtr->stderrInitialized + && tsdPtr->stderrChannel != NULL + && statePtr == ((Channel *)tsdPtr->stderrChannel)->state) { if (statePtr->refCount < 2) { statePtr->refCount = 0; tsdPtr->stderrChannel = NULL; |
