X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4d1c1c3c70f516e858ab076013641d41436cfe4e..ee495e4cab0139e65ac7a9867a57cef600e5c24b:/src/msw/thread.cpp diff --git a/src/msw/thread.cpp b/src/msw/thread.cpp index 66efdf36ac..a743d287b0 100644 --- a/src/msw/thread.cpp +++ b/src/msw/thread.cpp @@ -257,10 +257,15 @@ public: void Broadcast() { + // we need to save the original value as m_nWaiters is goign to be + // decreased by the signalled thread resulting in the loop being + // executed less times than needed + LONG nWaiters = m_nWaiters; + // this works because all these threads are already waiting and so each // SetEvent() inside Signal() is really a PulseEvent() because the // event state is immediately returned to non-signaled - for ( LONG n = 0; n < m_nWaiters; n++ ) + for ( LONG n = 0; n < nWaiters; n++ ) { Signal(); }