X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fb3e83b60a5eeb499bb2934ce4fa0f0cdff5fbec..7424a6375b3dd1e080848ec215b5e8b071240326:/src/common/init.cpp 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; ) }