X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c085e333984dc079a001cd3f581aeb1f51a1f227..2e5dddb0a4df12c32177dd706c4658c551b85da9:/src/msw/app.cpp?ds=inline diff --git a/src/msw/app.cpp b/src/msw/app.cpp index ef1aa4bd95..f0c45de1cd 100644 --- a/src/msw/app.cpp +++ b/src/msw/app.cpp @@ -10,14 +10,14 @@ ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ - #pragma implementation "app.h" +#pragma implementation "app.h" #endif // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" #if defined(__BORLANDC__) - #pragma hdrstop +#pragma hdrstop #endif #ifndef WX_PRECOMP @@ -51,6 +51,8 @@ #endif // use debug CRT functions for memory leak detections in VC++ +/* Here we go again commenting it out. PLEASE don't + * uncomment this again. #if defined(__WXDEBUG__) && defined(_MSC_VER) // VC++ uses this macro as debug/release mode indicator #ifndef _DEBUG @@ -59,6 +61,7 @@ #include #endif +*/ extern char *wxBuffer; extern char *wxOsVersion; @@ -112,14 +115,22 @@ bool wxApp::Initialize() { wxBuffer = new char[1500]; +/* PLEASE don't uncomment this again. IT DOESN'T WORK when building + * using the makefile. #if defined(__WXDEBUG__) && defined(_MSC_VER) // do check for memory leaks on program exit // (another useful flag is _CRTDBG_DELAY_FREE_MEM_DF which doesn't free // deallocated memory which may be used to simulate low-memory condition) _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF); #endif // debug build under MS VC++ +*/ - #if (WXDEBUG && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT + +// 22/11/98: we're converting to wxLogDebug instead of wxTrace, +// so these are now obsolete. + +#if 0 + #if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT #if defined(_WINDLL) streambuf* sBuf = NULL; #else // EXE @@ -129,6 +140,7 @@ bool wxApp::Initialize() ostream* oStr = new ostream(sBuf) ; wxDebugContext::SetStream(oStr, sBuf); #endif // wxUSE_MEMORY_TRACING +#endif wxClassInfo::InitializeClasses(); @@ -488,6 +500,23 @@ void wxApp::CleanUp() wxClassInfo::CleanUpClasses(); + delete wxTheApp; + wxTheApp = NULL; + +#if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT + // At this point we want to check if there are any memory + // blocks that aren't part of the wxDebugContext itself, + // as a special case. Then when dumping we need to ignore + // wxDebugContext, too. + if (wxDebugContext::CountObjectsLeft() > 0) + { + wxLogDebug("There were memory leaks."); + wxDebugContext::Dump(); + wxDebugContext::PrintStatistics(); + } +// wxDebugContext::SetStream(NULL, NULL); +#endif + // do it as the very last thing because everything else can log messages wxLog::DontCreateOnDemand(); delete wxLog::SetActiveTarget(NULL); @@ -562,24 +591,14 @@ int wxEntry(WXHINSTANCE hInstance, } wxTheApp->OnExit(); - wxApp::CleanUp(); - delete wxTheApp; - wxTheApp = NULL; + // flush the logged messages if any + wxLog *pLog = wxLog::GetActiveTarget(); + if ( pLog != NULL && pLog->HasPendingMessages() ) + pLog->Flush(); -#if (WXDEBUG && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT - // At this point we want to check if there are any memory - // blocks that aren't part of the wxDebugContext itself, - // as a special case. Then when dumping we need to ignore - // wxDebugContext, too. - if (wxDebugContext::CountObjectsLeft() > 0) - { - wxTrace("There were memory leaks.\n"); - wxDebugContext::Dump(); - wxDebugContext::PrintStatistics(); - } - wxDebugContext::SetStream(NULL, NULL); -#endif + + wxApp::CleanUp(); return retValue; #ifndef __WXDEBUG__ // catch exceptions only in release build @@ -848,7 +867,7 @@ bool wxApp::SendIdleEvents(wxWindow* win) wxIdleEvent event; event.SetEventObject(win); - win->ProcessEvent(event); + win->GetEventHandler()->ProcessEvent(event); if (event.MoreRequested()) needMore = TRUE;