git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23741
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
return -1;
}
- // app execution
- int retValue = wxTheApp->OnRun();
-
- // app clean up
- wxTheApp->OnExit();
+ // ensure that OnExit() is called if OnInit() had succeeded
+ class CallOnExit
+ {
+ public:
+ ~CallOnExit() { wxTheApp->OnExit(); }
+ } callOnExit;
- return retValue;
+ // app execution
+ return wxTheApp->OnRun();
}
wxCATCH_ALL( wxTheApp->OnUnhandledException(); return -1; )
}