summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp
index f008896b..ed7270bf 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -128,6 +128,7 @@ bool bootstrap()
}
thread_local LPTOP_LEVEL_EXCEPTION_FILTER prevUnhandledExceptionFilter = nullptr;
+thread_local std::terminate_handler prevTerminateHandler = nullptr;
LONG WINAPI MyUnhandledExceptionFilter(struct _EXCEPTION_POINTERS *exceptionPtrs)
{
@@ -158,12 +159,18 @@ void terminateHandler() noexcept
)
{
}
+
+ if (prevTerminateHandler) {
+ prevTerminateHandler();
+ } else {
+ std::abort();
+ }
}
void setUnhandledExceptionHandler()
{
prevUnhandledExceptionFilter = SetUnhandledExceptionFilter(MyUnhandledExceptionFilter);
- std::set_terminate(terminateHandler);
+ prevTerminateHandler = std::set_terminate(terminateHandler);
}
// Parses the first parseArgCount arguments of the current process command line and returns