From cb252b1ce2336c3cc77f445247c9048f8162cfcf Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Sat, 29 Feb 2020 18:36:51 +0300 Subject: [PATCH] Partial revert of 5871c4e93f06b233abe9c54411e4e0fec8bff1d2 --- Utilities/Thread.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Utilities/Thread.cpp b/Utilities/Thread.cpp index 9c79539f33..e4744bf655 100644 --- a/Utilities/Thread.cpp +++ b/Utilities/Thread.cpp @@ -1531,6 +1531,11 @@ static LONG exception_handler(PEXCEPTION_POINTERS pExp) noexcept } } + return EXCEPTION_CONTINUE_SEARCH; +} + +static LONG exception_filter(PEXCEPTION_POINTERS pExp) noexcept +{ std::string msg = fmt::format("Unhandled Win32 exception 0x%08X.\n", pExp->ExceptionRecord->ExceptionCode); if (pExp->ExceptionRecord->ExceptionCode == EXCEPTION_ACCESS_VIOLATION) @@ -1638,6 +1643,11 @@ const bool s_exception_handler_set = []() -> bool report_fatal_error("AddVectoredExceptionHandler() failed."); } + if (!SetUnhandledExceptionFilter((LPTOP_LEVEL_EXCEPTION_FILTER)exception_filter)) + { + report_fatal_error("SetUnhandledExceptionFilter() failed."); + } + return true; }();