X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/53010e52d3adc63d2771263e294714bf644fc979..54ff4a701f6c83aad8387a31b652f209681210cb:/src/gtk1/app.cpp diff --git a/src/gtk1/app.cpp b/src/gtk1/app.cpp index ee5c02afca..2317ad5320 100644 --- a/src/gtk1/app.cpp +++ b/src/gtk1/app.cpp @@ -18,11 +18,12 @@ #include "wx/postscrp.h" #include "wx/intl.h" #include "wx/log.h" +#include "wx/memory.h" #include "unistd.h" #ifdef USE_GDK_IMLIB -#include "gdk_imlib.h" +#include "../gdk_imlib/gdk_imlib.h" #endif //----------------------------------------------------------------------------- @@ -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; };