summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
Diffstat (limited to 'generic')
-rw-r--r--generic/tclIO.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c
index e6439ef..41ac1e1 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -5611,6 +5611,11 @@ DoReadChars(
ResetFlag(statePtr, CHANNEL_BLOCKED);
}
result = GetInput(chanPtr);
+if (chanPtr != statePtr->topChanPtr) {
+Tcl_Release(chanPtr);
+chanPtr = statePtr->topChanPtr;
+Tcl_Preserve(chanPtr);
+}
if (result != 0) {
if (result == EAGAIN) {
break;