X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/493902ac5be1c347e35c3550cd35d68696d02a61..31478355f8348d7dfb1c647919b62b224acfa8a0:/src/cocoa/app.mm diff --git a/src/cocoa/app.mm b/src/cocoa/app.mm index 28ef36b30d..fc253712db 100644 --- a/src/cocoa/app.mm +++ b/src/cocoa/app.mm @@ -41,6 +41,7 @@ #import #import #import +#import // ---------------------------------------------------------------------------- // globals @@ -133,6 +134,7 @@ END_EVENT_TABLE() bool wxApp::Initialize(int& argc, wxChar **argv) { wxAutoNSAutoreleasePool pool; + m_cocoaMainThread = [NSThread currentThread]; // Mac OS X passes a process serial number command line argument when // the application is launched from the Finder. This argument must be // removed from the command line arguments before being handled by the @@ -168,7 +170,6 @@ void wxApp::CleanUp() wxApp::wxApp() { m_topWindow = NULL; - wxTheApp = this; m_isIdle = true; #if WXWIN_COMPATIBILITY_2_2 @@ -182,6 +183,12 @@ wxApp::wxApp() void wxApp::CocoaInstallIdleHandler() { + // If we're not the main thread, don't install the idle handler + if(m_cocoaMainThread != [NSThread currentThread]) + { + wxLogDebug("Attempt to install idle handler from secondary thread"); + return; + } // If we're supposed to be stopping, don't add more idle events if(![m_cocoaApp isRunning]) return; @@ -212,7 +219,7 @@ bool wxApp::OnInitGui() bool wxApp::CallOnInit() { - wxAutoNSAutoreleasePool pool; +// wxAutoNSAutoreleasePool pool; return OnInit(); }