summaryrefslogtreecommitdiffstats
path: root/generic/tclIORChan.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2023-02-21 16:09:18 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2023-02-21 16:09:18 (GMT)
commit417f86869302e367a498d61a8bed0aa755746517 (patch)
tree313469a3faa7a2294980107c2a8374119404c4c6 /generic/tclIORChan.c
parent5866ef6d2acf4db24499c820df08a8feb88ea865 (diff)
downloadtcl-417f86869302e367a498d61a8bed0aa755746517.zip
tcl-417f86869302e367a498d61a8bed0aa755746517.tar.gz
tcl-417f86869302e367a498d61a8bed0aa755746517.tar.bz2
Proposed fix for [534172ff5b]: Crash in DeleteReflectedChannelMap (introduced via tcllib 1.21)
Diffstat (limited to 'generic/tclIORChan.c')
-rw-r--r--generic/tclIORChan.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/generic/tclIORChan.c b/generic/tclIORChan.c
index 7ea50c8..8c6f25f 100644
--- a/generic/tclIORChan.c
+++ b/generic/tclIORChan.c
@@ -1128,8 +1128,8 @@ ReflectClose(
/*
* This call comes from TclFinalizeIOSystem. There are no
* interpreters, and therefore we cannot call upon the handler command
- * anymore. Threading is irrelevant as well. We simply clean up all
- * our C level data structures and leave the Tcl level to the other
+ * anymore. Threading is irrelevant as well. Simply clean up all
+ * the C level data structures and leave the Tcl level to the other
* finalization functions.
*/
@@ -2697,6 +2697,7 @@ DeleteThreadReflectedChannelMap(
Tcl_ThreadId self = Tcl_GetCurrentThread();
ReflectedChannelMap *rcmPtr; /* The map */
ForwardingResult *resultPtr;
+ ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
(void)dummy;
/*
@@ -2777,6 +2778,7 @@ DeleteThreadReflectedChannelMap(
*/
rcmPtr = GetThreadReflectedChannelMap();
+ tsdPtr->rcmPtr = NULL;
for (hPtr = Tcl_FirstHashEntry(&rcmPtr->map, &hSearch);
hPtr != NULL;
hPtr = Tcl_FirstHashEntry(&rcmPtr->map, &hSearch)) {
@@ -3083,10 +3085,10 @@ ForwardProc(
(paramPtr->seek.seekMode==SEEK_SET) ? "start" :
(paramPtr->seek.seekMode==SEEK_CUR) ? "current" : "end", -1);
- Tcl_IncrRefCount(offObj);
- Tcl_IncrRefCount(baseObj);
+ Tcl_IncrRefCount(offObj);
+ Tcl_IncrRefCount(baseObj);
- Tcl_Preserve(rcPtr);
+ Tcl_Preserve(rcPtr);
if (InvokeTclMethod(rcPtr, METH_SEEK, offObj, baseObj, &resObj)!=TCL_OK){
ForwardSetObjError(paramPtr, resObj);
paramPtr->seek.offset = -1;