From: David Elliott Date: Mon, 14 Jul 2003 02:46:12 +0000 (+0000) Subject: Call -[NSApplication stop] instead of terminate. The stop message will X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/bc34fa2617f49d6e4c34db243ec0cdf62dd246c6 Call -[NSApplication stop] instead of terminate. The stop message will return to the caller allowing processing to continue until all events have been processed. Make sure that no more idle events are installed by checking -[NSApplication isRunning]. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21944 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/cocoa/app.mm b/src/cocoa/app.mm index b9777b2137..baf11a8636 100644 --- a/src/cocoa/app.mm +++ b/src/cocoa/app.mm @@ -195,6 +195,9 @@ wxApp::wxApp() void wxApp::CocoaInstallIdleHandler() { + // If we're supposed to be stopping, don't add more idle events + if(![m_cocoaApp isRunning]) + return; wxLogDebug("wxApp::CocoaInstallIdleHandler"); m_isIdle = false; // Call doIdle for EVERYTHING dammit @@ -260,7 +263,7 @@ void wxApp::ExitMainLoop() if(!m_isIdle) [[ NSRunLoop currentRunLoop ] cancelPerformSelector:@selector(doIdle:) target:m_cocoaApp argument:NULL]; #endif - [m_cocoaApp terminate: m_cocoaApp]; + [m_cocoaApp stop: m_cocoaApp]; } // Is a message/event pending?