summaryrefslogtreecommitdiffstats
path: root/generic/tclIORChan.c
diff options
context:
space:
mode:
authoraku <akupries@shaw.ca>2014-06-20 05:05:21 (GMT)
committeraku <akupries@shaw.ca>2014-06-20 05:05:21 (GMT)
commit871b2c750d594d61b15d9fcd809dd50633ad881c (patch)
tree1d1a549ad66bd274908105924e51cc0f002b77d3 /generic/tclIORChan.c
parent257bf7b5a42ece1ec140cb5d1b03ee43baef5e62 (diff)
downloadtcl-871b2c750d594d61b15d9fcd809dd50633ad881c.zip
tcl-871b2c750d594d61b15d9fcd809dd50633ad881c.tar.gz
tcl-871b2c750d594d61b15d9fcd809dd50633ad881c.tar.bz2
[b47b176adf] Stop possible segfaults when variability in mutex lock
schedules cause a ForwardingResult to remain on the forwardList after it has been processed (IORChan is the origin of the code in IORTrans).
Diffstat (limited to 'generic/tclIORChan.c')
-rw-r--r--generic/tclIORChan.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/generic/tclIORChan.c b/generic/tclIORChan.c
index 3107f9e..e1bd6e1 100644
--- a/generic/tclIORChan.c
+++ b/generic/tclIORChan.c
@@ -2384,10 +2384,18 @@ DeleteReflectedChannelMap(
/*
* The receiver for the event exited, before processing the event. We
* detach the result now, wake the originator up and signal failure.
+ *
+ * Attention: Results may have been detached already, by either the
+ * receiver, or this thread, as part of other parts in the thread
+ * teardown. Such results are ignored. See ticket [b47b176adf] for the
+ * identical race condition in Tcl 8.6 IORTrans.
*/
evPtr = resultPtr->evPtr;
paramPtr = evPtr->param;
+ if (!evPtr) {
+ continue;
+ }
evPtr->resultPtr = NULL;
resultPtr->evPtr = NULL;
@@ -2515,10 +2523,18 @@ DeleteThreadReflectedChannelMap(
/*
* The receiver for the event exited, before processing the event. We
* detach the result now, wake the originator up and signal failure.
+ *
+ * Attention: Results may have been detached already, by either the
+ * receiver, or this thread, as part of other parts in the thread
+ * teardown. Such results are ignored. See ticket [b47b176adf] for the
+ * identical race condition in Tcl 8.6 IORTrans.
*/
evPtr = resultPtr->evPtr;
paramPtr = evPtr->param;
+ if (!evPtr) {
+ continue;
+ }
evPtr->resultPtr = NULL;
resultPtr->evPtr = NULL;