summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2014-05-01 16:33:39 (GMT)
committerdgp <dgp@users.sourceforge.net>2014-05-01 16:33:39 (GMT)
commitb18161555e63f857014d2306adcb9fbcad3c6144 (patch)
tree4aac92dc41c8a340a4fe4cb06ddf02b7f7b01cfe
parent7526dfb7b5a0389d1442df96f1cfb2b7173649ed (diff)
downloadtcl-b18161555e63f857014d2306adcb9fbcad3c6144.zip
tcl-b18161555e63f857014d2306adcb9fbcad3c6144.tar.gz
tcl-b18161555e63f857014d2306adcb9fbcad3c6144.tar.bz2
Stop the segfault in iogt-2.4. First by changing the UpdateInterest()
call that triggers it. "downChanPtr" may no longer be the right argument at that point. Second, after ending the segfault, the test became an infinite loop (nested unstacking?! whoa.), so revised the test to one that terminates (and passes). Left behind a comment that the recursive unstacking case may require more examination.
-rw-r--r--generic/tclIO.c9
-rw-r--r--tests/iogt.test2
2 files changed, 9 insertions, 2 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c
index 776ff12..a83cdcd 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -1876,6 +1876,13 @@ Tcl_UnstackChannel(
* into the old structure.
*/
+ /*
+ * TODO: Figure out how to handle the situation where the chan
+ * operations called below by this unstacking operation cause
+ * another unstacking recursively. In that case the downChanPtr
+ * value we're holding on to will not be the right thing.
+ */
+
Channel *downChanPtr = chanPtr->downChanPtr;
/*
@@ -1980,7 +1987,7 @@ Tcl_UnstackChannel(
*/
Tcl_EventuallyFree(chanPtr, TCL_DYNAMIC);
- UpdateInterest(downChanPtr);
+ UpdateInterest(statePtr->topChanPtr);
if (result != 0) {
Tcl_SetErrno(result);
diff --git a/tests/iogt.test b/tests/iogt.test
index bd3c67b..ded8bb9 100644
--- a/tests/iogt.test
+++ b/tests/iogt.test
@@ -228,7 +228,7 @@ proc id_torture {chan op data} {
delete/read -
clear_read {;#ignore}
flush/write -
- flush/read -
+ flush/read {}
write -
read {
testchannel unstack $chan