]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/init.cpp
started for unicode text control, in case we will not be able to get the MLTE EchoMod...
[wxWidgets.git] / src / common / init.cpp
index 774cbd2273c042793491bc2ff680ef9c9c61c52e..e6d803cbe432f2354e59d41b763123ad6151a55d 100644 (file)
@@ -338,16 +338,7 @@ static void DoCommonPostCleanup()
     FreeConvertedArgs();
 #endif // wxUSE_UNICODE
 
-    // check for memory leaks
-#if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
-    if (wxDebugContext::CountObjectsLeft(TRUE) > 0)
-    {
-        wxLogDebug(wxT("There were memory leaks.\n"));
-        wxDebugContext::Dump();
-        wxDebugContext::PrintStatistics();
-    }
-#endif // Debug
-
+    // Note: check for memory leaks is now done via wxDebugContextDumpDelayCounter
 #if wxUSE_LOG
     // and now delete the last logger as well
     delete wxLog::SetActiveTarget(NULL);
@@ -396,6 +387,7 @@ int wxEntryReal(int& argc, wxChar **argv)
 
     wxTRY
     {
+
         // app initialization
         if ( !wxTheApp->CallOnInit() )
         {
@@ -403,13 +395,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; )
 }