OS X: fix startup sequence when restoring session on >=10.7.

Make sure that OnInit() is called before MacReopenApp(). This is
normally the case, but it is possible for it to be called as the first
thing.  This can happen when OS X restores running apps when starting a
new user session. Apps that were hidden (dock only) when the previous
session terminated are only restored in a limited, resources-saving way
- the event loop is running, but didn't call anything in the app
delegate yet.  When the user clicks the icon,
applicationShouldHandleReopen: is called, but we didn't call OnInit()
yet. In this case, we shouldn't call MacReopenApp(), but should proceed
with normal initialization.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75885 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2014-02-15 16:59:18 +00:00
parent 2124c5688b
commit c76d1ea417

View File

@@ -109,7 +109,16 @@ void wxBell()
{
wxUnusedVar(flag);
wxUnusedVar(sender);
wxTheApp->MacReopenApp() ;
if ( wxTheApp->OSXInitWasCalled() )
wxTheApp->MacReopenApp();
// else: It's possible that this function was called as the first thing.
// This can happen when OS X restores running apps when starting a new
// user session. Apps that were hidden (dock only) when the previous
// session terminated are only restored in a limited, resources-saving
// way. When the user clicks the icon, applicationShouldHandleReopen:
// is called, but we didn't call OnInit() yet. In this case, we
// shouldn't call MacReopenApp(), but should proceed with normal
// initialization.
return NO;
}