diff options
author | andreas_kupries <akupries@shaw.ca> | 2009-01-22 00:11:24 (GMT) |
---|---|---|
committer | andreas_kupries <akupries@shaw.ca> | 2009-01-22 00:11:24 (GMT) |
commit | 5cfe1a875e35f27b272584f4b35bac4030002df4 (patch) | |
tree | 00d671c428f4d69a65613cb4995eb597cf7b2f45 | |
parent | 60f0c609aebe699812fbe32b1805a85a15a5241f (diff) | |
download | tcl-5cfe1a875e35f27b272584f4b35bac4030002df4.zip tcl-5cfe1a875e35f27b272584f4b35bac4030002df4.tar.gz tcl-5cfe1a875e35f27b272584f4b35bac4030002df4.tar.bz2 |
* generic/tclIORChan.c (ReflectClose): Fix for [Bug 2458202].
* generic/tclIORTrans.c (ReflectClose): Closing a channel may
supply NULL for the 'interp'. Test for finalization needs to be
different, and one place has to pull the interp out of the channel
instead.
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | generic/tclIORChan.c | 19 | ||||
-rw-r--r-- | generic/tclIORTrans.c | 17 |
3 files changed, 31 insertions, 13 deletions
@@ -1,3 +1,11 @@ +2009-01-21 Andreas Kupries <andreask@activestate.com> + + * generic/tclIORChan.c (ReflectClose): Fix for [Bug 2458202]. + * generic/tclIORTrans.c (ReflectClose): Closing a channel may + supply NULL for the 'interp'. Test for finalization needs to be + different, and one place has to pull the interp out of the channel + instead. + 2009-01-21 Don Porter <dgp@users.sourceforge.net> * generic/tclStringObj.c: New fix for [Bug 2494093] replaces the diff --git a/generic/tclIORChan.c b/generic/tclIORChan.c index d93df6b..66a65b8 100644 --- a/generic/tclIORChan.c +++ b/generic/tclIORChan.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: tclIORChan.c,v 1.36 2009/01/09 11:21:46 dkf Exp $ + * RCS: @(#) $Id: tclIORChan.c,v 1.37 2009/01/22 00:11:24 andreas_kupries Exp $ */ #include <tclInt.h> @@ -1049,7 +1049,7 @@ ReflectClose( * 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 @@ -1137,13 +1137,18 @@ ReflectClose( * NOTE: The channel may not be in the map. This is ok, that happens * when the channel 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 DeleteReflectedChannelMap exit-handler. */ - rcmPtr = GetReflectedChannelMap(interp); - hPtr = Tcl_FindHashEntry(&rcmPtr->map, - Tcl_GetChannelName(rcPtr->chan)); - if (hPtr) { - Tcl_DeleteHashEntry(hPtr); + if (rcPtr->interp) { + rcmPtr = GetReflectedChannelMap(rcPtr->interp); + hPtr = Tcl_FindHashEntry(&rcmPtr->map, + Tcl_GetChannelName(rcPtr->chan)); + if (hPtr) { + Tcl_DeleteHashEntry(hPtr); + } } #ifdef TCL_THREADS rcmPtr = GetThreadReflectedChannelMap(); 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); + } } /* |