diff --git a/uppsrc/Core/App.cpp b/uppsrc/Core/App.cpp index a05d3cb68..7875a18a6 100644 --- a/uppsrc/Core/App.cpp +++ b/uppsrc/Core/App.cpp @@ -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 diff --git a/uppsrc/Core/heapdbg.cpp b/uppsrc/Core/heapdbg.cpp index f406653a6..a72d0b8b9 100644 --- a/uppsrc/Core/heapdbg.cpp +++ b/uppsrc/Core/heapdbg.cpp @@ -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!");