summaryrefslogtreecommitdiffstats
path: root/generic/tclIO.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2014-05-02 13:02:48 (GMT)
committerdgp <dgp@users.sourceforge.net>2014-05-02 13:02:48 (GMT)
commit3452d681c93ec5cab5edc2d45bbd0d02f9beadb1 (patch)
tree038d0effb58fbff9c7fd57756fa9e82068677e84 /generic/tclIO.c
parent4f1714013f16d9993d2d68175d81fdb91ffc8190 (diff)
downloadtcl-3452d681c93ec5cab5edc2d45bbd0d02f9beadb1.zip
tcl-3452d681c93ec5cab5edc2d45bbd0d02f9beadb1.tar.gz
tcl-3452d681c93ec5cab5edc2d45bbd0d02f9beadb1.tar.bz2
Fully restore topChan resetting to accommodate self-restacking channels.
Diffstat (limited to 'generic/tclIO.c')
-rw-r--r--generic/tclIO.c43
1 files changed, 26 insertions, 17 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c
index 8ae2fd2..adea32e 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -4554,9 +4554,12 @@ Tcl_GetsObj(
* Regenerate the top channel, in case it was changed due to
* self-modifying reflected transforms.
*/
- /*
- chanPtr = statePtr->topChanPtr;
- */
+
+ if (chanPtr != statePtr->topChanPtr) {
+ Tcl_Release(chanPtr);
+ chanPtr = statePtr->topChanPtr;
+ Tcl_Preserve(chanPtr);
+ }
bufPtr = gs.bufPtr;
if (bufPtr == NULL) {
@@ -4590,9 +4593,11 @@ Tcl_GetsObj(
* Regenerate the top channel, in case it was changed due to
* self-modifying reflected transforms.
*/
- /*
- chanPtr = statePtr->topChanPtr;
- */
+ if (chanPtr != statePtr->topChanPtr) {
+ Tcl_Release(chanPtr);
+ chanPtr = statePtr->topChanPtr;
+ Tcl_Preserve(chanPtr);
+ }
bufPtr = statePtr->inQueueHead;
if (bufPtr != NULL) {
bufPtr->nextRemoved = oldRemoved;
@@ -4632,9 +4637,11 @@ Tcl_GetsObj(
* Regenerate the top channel, in case it was changed due to
* self-modifying reflected transforms.
*/
- /*
- chanPtr = statePtr->topChanPtr;
- */
+ if (chanPtr != statePtr->topChanPtr) {
+ Tcl_Release(chanPtr);
+ chanPtr = statePtr->topChanPtr;
+ Tcl_Preserve(chanPtr);
+ }
UpdateInterest(chanPtr);
Tcl_Release(chanPtr);
return copiedTotal;
@@ -5638,11 +5645,11 @@ DoReadChars(
ResetFlag(statePtr, CHANNEL_BLOCKED);
}
result = GetInput(chanPtr);
-if (chanPtr != statePtr->topChanPtr) {
-Tcl_Release(chanPtr);
-chanPtr = statePtr->topChanPtr;
-Tcl_Preserve(chanPtr);
-}
+ if (chanPtr != statePtr->topChanPtr) {
+ Tcl_Release(chanPtr);
+ chanPtr = statePtr->topChanPtr;
+ Tcl_Preserve(chanPtr);
+ }
if (result != 0) {
if (result == EAGAIN) {
break;
@@ -5673,9 +5680,11 @@ Tcl_Preserve(chanPtr);
* Regenerate the top channel, in case it was changed due to
* self-modifying reflected transforms.
*/
- /*
- chanPtr = statePtr->topChanPtr;
- */
+ if (chanPtr != statePtr->topChanPtr) {
+ Tcl_Release(chanPtr);
+ chanPtr = statePtr->topChanPtr;
+ Tcl_Preserve(chanPtr);
+ }
UpdateInterest(chanPtr);
Tcl_Release(chanPtr);
return copied;