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:
parent
31e82060f1
commit
c46194d08b
1 changed files with 12 additions and 5 deletions
|
|
@ -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();
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue