In Win32, Ctrl-C on console app does not do leaks check anymore

This commit is contained in:
Mirek Fidler 2023-10-04 20:22:26 +02:00
parent 79fe8271b0
commit 462587fb49
2 changed files with 17 additions and 1 deletions

View file

@ -531,6 +531,16 @@ void AppInit__(int argc, const char **argv, const char **envptr)
#if defined(PLATFORM_WIN32)
#ifdef _DEBUG
static BOOL WINAPI s_consoleCtrlHandler(DWORD signal) {
if(signal == CTRL_C_EVENT) {
extern bool NoMemoryLeaksCheck;
NoMemoryLeaksCheck = true;
}
return FALSE;
}
#endif
void AppInitEnvironment__()
{
SetLanguage(LNG_('E', 'N', 'U', 'S'));
@ -567,6 +577,10 @@ void AppInitEnvironment__()
void AppInit__(int argc, const char **argv)
{
AppInitEnvironment__();
#ifdef _DEBUG
SetConsoleCtrlHandler(s_consoleCtrlHandler, TRUE);
#endif
}
#endif

View file

@ -225,9 +225,11 @@ void MemoryCheckDebug()
while(p != &dbg_live);
}
bool NoMemoryLeaksCheck;
void MemoryDumpLeaks()
{
if(PanicMode)
if(PanicMode || NoMemoryLeaksCheck)
return;
#ifdef PLATFORM_MACOS
return; // ignore leaks in macos