wxTRY
{
+
// app initialization
if ( !wxTheApp->CallOnInit() )
{
return -1;
}
- // app execution
- int retValue = wxTheApp->OnRun();
+ // ensure that OnExit() is called if OnInit() had succeeded
+ class CallOnExit
+ {
+ public:
+ ~CallOnExit() { wxTheApp->OnExit(); }
+ } callOnExit;
- // app clean up
- wxTheApp->OnExit();
+ WX_SUPPRESS_UNUSED_WARN(callOnExit);
- return retValue;
+ // app execution
+ return wxTheApp->OnRun();
}
wxCATCH_ALL( wxTheApp->OnUnhandledException(); return -1; )
}