X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1f0299c17dc878540bf190c290392db241b425ad..bd0df01f3f59940fdbca7a3472c256be2d034ab9:/src/gtk/app.cpp diff --git a/src/gtk/app.cpp b/src/gtk/app.cpp index 9cfd6f2253..2317ad5320 100644 --- a/src/gtk/app.cpp +++ b/src/gtk/app.cpp @@ -18,6 +18,7 @@ #include "wx/postscrp.h" #include "wx/intl.h" #include "wx/log.h" +#include "wx/memory.h" #include "unistd.h" @@ -285,6 +286,18 @@ int wxEntry( int argc, char *argv[] ) wxClassInfo::InitializeClasses(); +#if (WXDEBUG && USE_MEMORY_TRACING) || USE_DEBUG_CONTEXT + +#if !defined(_WINDLL) + streambuf* sBuf = new wxDebugStreamBuf; +#else + streambuf* sBuf = NULL; +#endif + ostream* oStr = new ostream(sBuf) ; + wxDebugContext::SetStream(oStr, sBuf); + +#endif + if (!wxTheApp) { if (!wxApp::GetInitializerFunction()) @@ -347,6 +360,20 @@ int wxEntry( int argc, char *argv[] ) wxApp::CommonCleanUp(); +#if (WXDEBUG && USE_MEMORY_TRACING) || USE_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 + return retValue; };