From 9b90398cf92ac05d87aeacdf962ee1212ac95bd4 Mon Sep 17 00:00:00 2001 From: reuk Date: Fri, 20 Nov 2020 12:12:35 +0000 Subject: [PATCH] IPC: Fix occasional windows crash As far as I can tell, if a read was cancelled from a background thread, the IO operation wasn't cancelled, so the system was poking at the stack-allocated OVERLAPPED structure after it had been removed from the stack, at which point something else might be occupying that region of stack memory. I'm pretty sure Address Sanitizer should be able to catch this sort of thing so I'm surprised it didn't complain here. --- modules/juce_core/native/juce_win32_Files.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/juce_core/native/juce_win32_Files.cpp b/modules/juce_core/native/juce_win32_Files.cpp index e0701dadc0..04843e07ab 100644 --- a/modules/juce_core/native/juce_win32_Files.cpp +++ b/modules/juce_core/native/juce_win32_Files.cpp @@ -1150,7 +1150,10 @@ private: bool waitForIO (OverlappedEvent& over, int timeOutMilliseconds) { if (shouldStop) + { + CancelIo (pipeH); return false; + } HANDLE handles[] = { over.over.hEvent, cancelEvent }; DWORD waitResult = WaitForMultipleObjects (2, handles, FALSE,