X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e83f230124bbc1dfc93d5c9b3586fcc57f07ecf1..9ca7505f1243ed1d2a2012caa09a52d41115c069:/src/common/init.cpp diff --git a/src/common/init.cpp b/src/common/init.cpp index bb56dd4007..aaa186cc16 100644 --- a/src/common/init.cpp +++ b/src/common/init.cpp @@ -181,6 +181,7 @@ static void ConvertArgsToUnicode(int argc, char **argv) gs_initData.argv[i] = wxStrdup(wxConvLocal.cMB2WX(argv[i])); } + gs_initData.argc = argc; gs_initData.argv[argc] = NULL; } @@ -195,6 +196,7 @@ static void FreeConvertedArgs() delete [] gs_initData.argv; gs_initData.argv = NULL; + gs_initData.argc = 0; } } @@ -310,26 +312,26 @@ bool wxEntryStart(int& argc, char **argv) // clean up // ---------------------------------------------------------------------------- -// cleanup done before destroying wxTheApp +// cleanup done before destroying wxTheApp static void DoCommonPreCleanup() { #if wxUSE_LOG // flush the logged messages if any and install a 'safer' log target: the // default one (wxLogGui) can't be used after the resources are freed just // below and the user supplied one might be even more unsafe (using any - // wxWindows GUI function is unsafe starting from now) + // wxWidgets GUI function is unsafe starting from now) wxLog::DontCreateOnDemand(); // this will flush the old messages if any delete wxLog::SetActiveTarget(new wxLogStderr); #endif // wxUSE_LOG - - wxModule::CleanUpModules(); } // cleanup done after destroying wxTheApp static void DoCommonPostCleanup() { + wxModule::CleanUpModules(); + wxClassInfo::CleanUp(); // we can't do this in wxApp itself because it doesn't know if argv had @@ -338,16 +340,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); @@ -394,17 +387,9 @@ int wxEntryReal(int& argc, wxChar **argv) WX_SUPPRESS_UNUSED_WARN(cleanupOnExit); -#if defined(__VISUALC__) - //Disable warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify -GX - #pragma warning (disable:4530) -#endif - wxTRY { -#if defined(__VISUALC__) - #pragma warning (default:4530) -#endif // app initialization if ( !wxTheApp->CallOnInit() ) {