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);
wxTRY
{
+
// app initialization
if ( !wxTheApp->CallOnInit() )
{
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; )
}