call OnExit() even if an exception has been thrown from OnRun()

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23741 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2003-09-20 16:18:19 +00:00
parent 7e33e48e00
commit fe277be0f1

View File

@ -403,13 +403,15 @@ int wxEntryReal(int& argc, wxChar **argv)
return -1;
}
// ensure that OnExit() is called if OnInit() had succeeded
class CallOnExit
{
public:
~CallOnExit() { wxTheApp->OnExit(); }
} callOnExit;
// app execution
int retValue = wxTheApp->OnRun();
// app clean up
wxTheApp->OnExit();
return retValue;
return wxTheApp->OnRun();
}
wxCATCH_ALL( wxTheApp->OnUnhandledException(); return -1; )
}