fix(exception_handler): crash on unload (#1280)
Restore the value the ErrorMode and the UnhandledExceptionFilter values.
This commit is contained in:
parent
a908b3fbc8
commit
2206995a9c
@ -16,14 +16,14 @@ namespace big
|
|||||||
|
|
||||||
exception_handler::exception_handler()
|
exception_handler::exception_handler()
|
||||||
{
|
{
|
||||||
SetErrorMode(0);
|
m_old_error_mode = SetErrorMode(0);
|
||||||
SetUnhandledExceptionFilter(&vectored_exception_handler);
|
m_exception_handler = SetUnhandledExceptionFilter(&vectored_exception_handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
exception_handler::~exception_handler()
|
exception_handler::~exception_handler()
|
||||||
{
|
{
|
||||||
// passing nullptr will make it go back to normal exception handling
|
SetErrorMode(m_old_error_mode);
|
||||||
SetUnhandledExceptionFilter(nullptr);
|
SetUnhandledExceptionFilter(reinterpret_cast<decltype(&vectored_exception_handler)>(m_exception_handler));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static stack_trace trace;
|
inline static stack_trace trace;
|
||||||
|
@ -1,17 +1,18 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "common.hpp"
|
#include "common.hpp"
|
||||||
|
|
||||||
namespace big
|
namespace big
|
||||||
{
|
{
|
||||||
class exception_handler final
|
class exception_handler final
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
exception_handler();
|
exception_handler();
|
||||||
virtual ~exception_handler();
|
virtual ~exception_handler();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void* m_exception_handler;
|
void* m_exception_handler;
|
||||||
};
|
std::uint32_t m_old_error_mode;
|
||||||
|
};
|
||||||
extern LONG vectored_exception_handler(EXCEPTION_POINTERS* exception_info);
|
|
||||||
|
extern LONG vectored_exception_handler(EXCEPTION_POINTERS* exception_info);
|
||||||
}
|
}
|
Reference in New Issue
Block a user