From fe277be0f1504fefcb24705dea52006d14fdebc8 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 20 Sep 2003 16:18:19 +0000 Subject: [PATCH] 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 --- src/common/init.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/common/init.cpp b/src/common/init.cpp index 774cbd2273..15cca2da32 100644 --- a/src/common/init.cpp +++ b/src/common/init.cpp @@ -403,13 +403,15 @@ int wxEntryReal(int& argc, wxChar **argv) 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; ) } -- 2.45.2