Only use CallOnInit the first time, otherwise the 2nd wx.App will block when being constructed. Fixes hang in unittests.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@77977 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2014-10-08 04:33:41 +00:00
parent 4ff09cf185
commit 6907bb85de

View File

@@ -242,7 +242,6 @@ void wxPyApp::_BootstrapApp()
);
goto error;
}
haveInitialized = true;
}
else {
this->argc = 0;
@@ -253,11 +252,23 @@ void wxPyApp::_BootstrapApp()
// Call the Python wxApp's OnPreInit and OnInit functions if they exist
OnPreInit();
result = CallOnInit();
#ifdef __WXOSX_COCOA__
// Only use CallOnInit the first time, otherwise it will block on [NSApp run];
if (! haveInitialized)
result = CallOnInit();
else
#endif
result = OnInit();
//#ifdef __WXOSX_COCOA__
// OSXSetInitWasCalled(true); TODO: consider adding this method to wxApp
//#endif
if (! result) {
wxPyErr_SetString(PyExc_SystemExit, "OnInit returned false, exiting...");
}
haveInitialized = true;
error:
return;