diff options
author | dgp <dgp@noemail.net> | 2012-10-03 15:29:59 (GMT) |
---|---|---|
committer | dgp <dgp@noemail.net> | 2012-10-03 15:29:59 (GMT) |
commit | ed43b3db2b8e6e5301047701f2342bf662f35f72 (patch) | |
tree | f5a13906329fd2a415bdfe358595e2c98c74d00a | |
parent | 2ddf5962d5b267658166ac90c41a0fc6c762595e (diff) | |
parent | 71179d597976c51ffa311ebc33bc0e46e0fc828d (diff) | |
download | tcl-ed43b3db2b8e6e5301047701f2342bf662f35f72.zip tcl-ed43b3db2b8e6e5301047701f2342bf662f35f72.tar.gz tcl-ed43b3db2b8e6e5301047701f2342bf662f35f72.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.
FossilOrigin-Name: 00425ee7d72a2f064b94669698e4af47c7b2ab21
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | generic/tclIO.c | 14 |
2 files changed, 15 insertions, 5 deletions
@@ -1,3 +1,9 @@ +2012-10-03 Don Porter <dgp@users.sourceforge.net> + + * generic/tclIO.c: When checking for std channels being closed, + compare the channel state, not the channel itself so that stacked + channels do not cause trouble. + 2012-09-07 Harald Oehlmann <oehhar@users.sf.net> IMPLEMENTATION OF TIP#404. 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; |