From 4403da58ff63129749e6e1e328c9f6d1034cd69b Mon Sep 17 00:00:00 2001 From: "james.k.crook@gmail.com" Date: Mon, 19 Mar 2012 17:54:52 +0000 Subject: [PATCH] Don't start logging window in debug builds under windows (we use the MSVC debugger window instead). Added (commented out) memory leak detection to AudacityHeaders.h --- src/AudacityApp.cpp | 16 +++++++++++----- src/AudacityHeaders.h | 15 +++++++++++++++ 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/AudacityApp.cpp b/src/AudacityApp.cpp index bc30e3abc..bd48b01b4 100644 --- a/src/AudacityApp.cpp +++ b/src/AudacityApp.cpp @@ -101,6 +101,7 @@ It handles initialization and termination by subclassing wxApp. #include "effects/ScoreAlignDialog.h" #endif +#if 0 #ifdef _DEBUG #ifdef _MSC_VER #undef THIS_FILE @@ -108,6 +109,7 @@ It handles initialization and termination by subclassing wxApp. #define new new(_NORMAL_BLOCK, THIS_FILE, __LINE__) #endif #endif +#endif // Windows specific linker control...only needed once so // this is a good place (unless we want to add another file). @@ -1005,12 +1007,16 @@ bool AudacityApp::OnInit() } #endif + // JKC: On windows, we only want a logger in release builds. + mLogger=NULL; #ifndef __WXMAC__ - mLogger = new wxLogWindow(NULL, wxT("Audacity Log"), false, false); - mLogger->SetActiveTarget(mLogger); - mLogger->EnableLogging(true); - mLogger->SetLogLevel(wxLOG_Max); - wxLogMessage(wxString::Format(wxT("Audacity %s"), AUDACITY_VERSION_STRING)); + #ifndef _DEBUG + mLogger = new wxLogWindow(NULL, wxT("Audacity Log"), false, false); + mLogger->SetActiveTarget(mLogger); + mLogger->EnableLogging(true); + mLogger->SetLogLevel(wxLOG_Max); + wxLogMessage(wxString::Format(wxT("Audacity %s"), AUDACITY_VERSION_STRING)); + #endif #endif // Unused strings that we want to be translated, even though diff --git a/src/AudacityHeaders.h b/src/AudacityHeaders.h index 415eb5daa..d60f65dc4 100644 --- a/src/AudacityHeaders.h +++ b/src/AudacityHeaders.h @@ -72,3 +72,18 @@ #include "widgets/ProgressDialog.h" #include "widgets/Ruler.h" +//#ifdef __WXMSW__ +// Enable this to diagnose memory leaks too! +// #include // redefines the new() operator +//#endif + +#if 0 +#define _DEBUG +#ifdef _DEBUG +#define _CRTDBG_MAP_ALLOC +#include +#include +#define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) +#define new DEBUG_NEW +#endif +#endif