1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-30 02:50:05 +00:00

Windows: Fixed a deadlock that could occur when dispatching messages from the overflow queue

This commit is contained in:
ed 2019-12-06 16:57:09 +00:00
parent 31e82060f1
commit c46194d08b

View file

@ -230,16 +230,23 @@ private:
void dispatchOverflowMessages()
{
const ScopedLock sl (lock);
ReferenceCountedArray<MessageManager::MessageBase> messagesToDispatch;
for (int i = 0; i < overflowQueue.size(); ++i)
{
auto message = overflowQueue.getUnchecked (i);
const ScopedLock sl (lock);
if (overflowQueue.isEmpty())
return;
messagesToDispatch.swapWith (overflowQueue);
}
for (int i = 0; i < messagesToDispatch.size(); ++i)
{
auto message = messagesToDispatch.getUnchecked (i);
message->incReferenceCount();
dispatchMessageFromLParam ((LPARAM) message.get());
}
overflowQueue.clear();
}
//==============================================================================