summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandreas_kupries <akupries@shaw.ca>2005-11-18 17:15:57 (GMT)
committerandreas_kupries <akupries@shaw.ca>2005-11-18 17:15:57 (GMT)
commit65b8110408a9e9de87923320659674a3871d9ea5 (patch)
treee91d806ee825bfc5d03c9d59f4dd5b3b19b300b5
parenta8c8af2d7203f31a4c526483f57e1674db35d1e8 (diff)
downloadtcl-65b8110408a9e9de87923320659674a3871d9ea5.zip
tcl-65b8110408a9e9de87923320659674a3871d9ea5.tar.gz
tcl-65b8110408a9e9de87923320659674a3871d9ea5.tar.bz2
* generic/tclIO.c (TclFinalizeIOSubsystem): Applied Pat Thoyts'
patch for [SF Tcl Bug 1359094]. This moves the retrieval of the next channel state to the end of the loop, as the called closeproc may close other channels, i.e. modify the list we are iterating, invalidating any pointer retrieved earlier.
-rw-r--r--ChangeLog8
-rw-r--r--generic/tclIO.c8
2 files changed, 14 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 4f102e0..52c5c5d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2005-11-18 Andreas Kupries <andreask@activestate.com>
+
+ * generic/tclIO.c (TclFinalizeIOSubsystem): Applied Pat Thoyts'
+ patch for [SF Tcl Bug 1359094]. This moves the retrieval of the
+ next channel state to the end of the loop, as the called
+ closeproc may close other channels, i.e. modify the list we are
+ iterating, invalidating any pointer retrieved earlier.
+
2005-11-18 Don Porter <dgp@users.sourceforge.net>
* generic/tclListObj.c: Restored the SetListFromAny routine to
diff --git a/generic/tclIO.c b/generic/tclIO.c
index a449875..606ec75 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclIO.c,v 1.100 2005/10/31 17:15:50 dgp Exp $
+ * RCS: @(#) $Id: tclIO.c,v 1.101 2005/11/18 17:15:57 andreas_kupries Exp $
*/
#include "tclInt.h"
@@ -182,7 +182,6 @@ TclFinalizeIOSubsystem(void)
for (statePtr = tsdPtr->firstCSPtr; statePtr != NULL;
statePtr = nextCSPtr) {
chanPtr = statePtr->topChanPtr;
- nextCSPtr = statePtr->nextCSPtr;
/*
* Set the channel back into blocking mode to ensure that we wait for
@@ -240,6 +239,11 @@ TclFinalizeIOSubsystem(void)
chanPtr->instanceData = NULL;
statePtr->flags |= CHANNEL_DEAD;
}
+ /*
+ * We look for the next pointer now in case we had one closed on up during
+ * the current channel's closeproc. (eg: rechan extension). [PT]
+ */
+ nextCSPtr = statePtr->nextCSPtr;
}
TclpFinalizePipes();
}