From 871b2c750d594d61b15d9fcd809dd50633ad881c Mon Sep 17 00:00:00 2001 From: aku Date: Fri, 20 Jun 2014 05:05:21 +0000 Subject: [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). --- generic/tclIORChan.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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; -- cgit v0.12