From ddd40d4397a9a7d3f85bf70e1be9f29e4fdc85a4 Mon Sep 17 00:00:00 2001 From: anders_k Date: Tue, 11 Aug 2020 22:52:25 +0000 Subject: [PATCH] Postpone leak check so that global destructors can run first git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7213 212acab6-be3b-0410-9dea-997c60f758d6 --- Source/makenssi.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/makenssi.cpp b/Source/makenssi.cpp index 181a2cc3..436bb831 100644 --- a/Source/makenssi.cpp +++ b/Source/makenssi.cpp @@ -685,7 +685,8 @@ int _tmain(int argc, TCHAR **argv) { #ifndef NDEBUG #ifdef _MSC_VER - _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_CHECK_ALWAYS_DF); + const int dbgchkthorough = true, checkeveryallocfree = dbgchkthorough ? _CRTDBG_CHECK_ALWAYS_DF : 0; + _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_ALLOC_MEM_DF | checkeveryallocfree | _CRTDBG_LEAK_CHECK_DF); _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE), _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDOUT); _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE), _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDOUT); //_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE), _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDOUT); @@ -694,7 +695,6 @@ int _tmain(int argc, TCHAR **argv) int retval = makensismain(argc,argv); #ifndef NDEBUG #ifdef _MSC_VER - _CrtDumpMemoryLeaks(); assert(_CrtCheckMemory()); #endif #endif