Don't overflow the message queue in wxEventLoop::WakeUp() in wxOSX.

First, don't add any events at all to it unless it's empty. Second, post new
events with low priority instead of high one, we really don't care about them
getting processed, other, real, events should take priority.

Closes #14256.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78319 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-12-25 01:32:15 +00:00
parent 20c130a578
commit 26216bccba

View File

@@ -84,12 +84,17 @@ int wxGUIEventLoop::DoDispatchTimeout(unsigned long timeout)
void wxGUIEventLoop::WakeUp() void wxGUIEventLoop::WakeUp()
{ {
// If there's already one or more events in the queue then there's no need
// to post another one.
if ( GetNumEventsInQueue( GetMainEventQueue() ) > 0 )
return;
OSStatus err = noErr; OSStatus err = noErr;
wxMacCarbonEvent wakeupEvent; wxMacCarbonEvent wakeupEvent;
wakeupEvent.Create( 'WXMC', 'WXMC', GetCurrentEventTime(), wakeupEvent.Create( 'WXMC', 'WXMC', GetCurrentEventTime(),
kEventAttributeNone ); kEventAttributeNone );
err = PostEventToQueue(GetMainEventQueue(), wakeupEvent, err = PostEventToQueue(GetMainEventQueue(), wakeupEvent,
kEventPriorityHigh ); kEventPriorityLow );
} }
void wxGUIEventLoop::OSXDoRun() void wxGUIEventLoop::OSXDoRun()