]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/init.cpp
fixed wrong handling of magenta (patch #882201)
[wxWidgets.git] / src / common / init.cpp
index 774cbd2273c042793491bc2ff680ef9c9c61c52e..a67f723b64e2813dc9a1373506b49844fdd0c005 100644 (file)
@@ -396,6 +396,7 @@ int wxEntryReal(int& argc, wxChar **argv)
 
     wxTRY
     {
+
         // app initialization
         if ( !wxTheApp->CallOnInit() )
         {
@@ -403,13 +404,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; )
 }