X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fb3e83b60a5eeb499bb2934ce4fa0f0cdff5fbec..56fc3fa5b3be585a27af0ac3263350e16c992e41:/src/common/init.cpp?ds=sidebyside diff --git a/src/common/init.cpp b/src/common/init.cpp index 774cbd2273..39874736bf 100644 --- a/src/common/init.cpp +++ b/src/common/init.cpp @@ -403,13 +403,17 @@ int wxEntryReal(int& argc, wxChar **argv) 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; ) }