From 26216bccbab7ae6db23cdd8c6094caa3a1aa7d7f Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 25 Dec 2014 01:32:15 +0000 Subject: [PATCH] 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 --- src/osx/carbon/evtloop.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/osx/carbon/evtloop.cpp b/src/osx/carbon/evtloop.cpp index 4a8238baa0..70cda830f4 100644 --- a/src/osx/carbon/evtloop.cpp +++ b/src/osx/carbon/evtloop.cpp @@ -84,12 +84,17 @@ int wxGUIEventLoop::DoDispatchTimeout(unsigned long timeout) 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; wxMacCarbonEvent wakeupEvent; wakeupEvent.Create( 'WXMC', 'WXMC', GetCurrentEventTime(), kEventAttributeNone ); err = PostEventToQueue(GetMainEventQueue(), wakeupEvent, - kEventPriorityHigh ); + kEventPriorityLow ); } void wxGUIEventLoop::OSXDoRun()