summaryrefslogtreecommitdiffstats
path: root/generic/tclIORChan.c
diff options
context:
space:
mode:
authoraku <akupries@shaw.ca>2014-06-20 05:14:43 (GMT)
committeraku <akupries@shaw.ca>2014-06-20 05:14:43 (GMT)
commit58f1972185fa5d9693fe02d406066bf201d99263 (patch)
tree3c39fabb6a230d9b565729a175992c6c5f3efc5b /generic/tclIORChan.c
parent002bdcfeb0578c3dc428a72d3bdd33b476740519 (diff)
parent871b2c750d594d61b15d9fcd809dd50633ad881c (diff)
downloadtcl-58f1972185fa5d9693fe02d406066bf201d99263.zip
tcl-58f1972185fa5d9693fe02d406066bf201d99263.tar.gz
tcl-58f1972185fa5d9693fe02d406066bf201d99263.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 6a43441..ff602c6 100644
--- a/generic/tclIORChan.c
+++ b/generic/tclIORChan.c
@@ -2527,6 +2527,11 @@ 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;
@@ -2536,6 +2541,9 @@ DeleteReflectedChannelMap(
continue;
}
paramPtr = evPtr->param;
+ if (!evPtr) {
+ continue;
+ }
evPtr->resultPtr = NULL;
resultPtr->evPtr = NULL;
@@ -2666,6 +2674,11 @@ 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;
@@ -2675,6 +2688,9 @@ DeleteThreadReflectedChannelMap(
continue;
}
paramPtr = evPtr->param;
+ if (!evPtr) {
+ continue;
+ }
evPtr->resultPtr = NULL;
resultPtr->evPtr = NULL;