summaryrefslogtreecommitdiffstats
path: root/generic/tclIORTrans.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclIORTrans.c')
-rw-r--r--generic/tclIORTrans.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/generic/tclIORTrans.c b/generic/tclIORTrans.c
index b847d42..2cf38b1 100644
--- a/generic/tclIORTrans.c
+++ b/generic/tclIORTrans.c
@@ -15,7 +15,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclIORTrans.c,v 1.7 2009/01/09 11:21:46 dkf Exp $
+ * RCS: @(#) $Id: tclIORTrans.c,v 1.8 2009/01/22 00:11:24 andreas_kupries Exp $
*/
#include <tclInt.h>
@@ -895,7 +895,7 @@ ReflectClose(
* in this interp. */
Tcl_HashEntry *hPtr; /* Entry in the above map */
- if (interp == NULL) {
+ if (TclInThreadExit()) {
/*
* This call comes from TclFinalizeIOSystem. There are no
* interpreters, and therefore we cannot call upon the handler command
@@ -1003,12 +1003,17 @@ ReflectClose(
* NOTE: The transform may not be in the map. This is ok, that happens
* when the transform was created in a different interpreter and/or thread
* and then was moved here.
+ *
+ * NOTE: The channel may have been removed from the map already via
+ * the per-interp DeleteReflectedTransformMap exit-handler.
*/
- rtmPtr = GetReflectedTransformMap(interp);
- hPtr = Tcl_FindHashEntry(&rtmPtr->map, Tcl_GetString(rtPtr->handle));
- if (hPtr) {
- Tcl_DeleteHashEntry(hPtr);
+ if (rtPtr->interp) {
+ rtmPtr = GetReflectedTransformMap(rtPtr->interp);
+ hPtr = Tcl_FindHashEntry(&rtmPtr->map, Tcl_GetString(rtPtr->handle));
+ if (hPtr) {
+ Tcl_DeleteHashEntry(hPtr);
+ }
}
/*