Core: Detection of non-standard exit (supressing leaks detection)

git-svn-id: svn://ultimatepp.org/upp/trunk@13509 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2019-07-23 07:35:01 +00:00
parent a04da0e3ab
commit 583dc7ddd9
2 changed files with 9 additions and 0 deletions

View file

@ -337,6 +337,8 @@ void Exit(int code)
throw ExitExc();
}
bool AppNormalExit;
void AppExecute__(void (*app)())
{
try {
@ -345,6 +347,7 @@ void AppExecute__(void (*app)())
catch(ExitExc) {
return;
}
AppNormalExit = true;
}
#ifdef PLATFORM_POSIX

View file

@ -10,6 +10,8 @@ int sMemDiagInitCount;
namespace Upp {
extern bool AppNormalExit;
#if defined(UPP_HEAP)
#include "HeapImp.h"
@ -192,6 +194,10 @@ void MemoryDumpLeaks()
{
if(PanicMode)
return;
if(!AppNormalExit) {
VppLog() << "Application was terminated in a non-standard way (e.g. exit(x) call or Ctrl+C)\n";
return;
}
#ifndef PLATFORM_POSIX
if(s_ignoreleaks)
Panic("Ignore leaks Begin/End mismatch!");