forked from cory/tildefriends
ssb: Fix a crash on Windows when we would call uv_async_send on a handle that had already been closed. Various other cleanup and improvements along the journey. #96
This commit is contained in:
12
src/main.c
12
src/main.c
@ -1011,10 +1011,8 @@ static void _error_handler(int sig)
|
||||
#if defined(_WIN32)
|
||||
static LONG WINAPI _win32_exception_handler(EXCEPTION_POINTERS* info)
|
||||
{
|
||||
if (info->ExceptionRecord->ExceptionCode == STATUS_ACCESS_VIOLATION ||
|
||||
info->ExceptionRecord->ExceptionCode == STATUS_ILLEGAL_INSTRUCTION ||
|
||||
info->ExceptionRecord->ExceptionCode == STATUS_STACK_OVERFLOW ||
|
||||
info->ExceptionRecord->ExceptionCode == STATUS_HEAP_CORRUPTION)
|
||||
if (info->ExceptionRecord->ExceptionCode == STATUS_ACCESS_VIOLATION || info->ExceptionRecord->ExceptionCode == STATUS_ILLEGAL_INSTRUCTION ||
|
||||
info->ExceptionRecord->ExceptionCode == STATUS_STACK_OVERFLOW || info->ExceptionRecord->ExceptionCode == STATUS_HEAP_CORRUPTION)
|
||||
{
|
||||
const char* stack = tf_util_backtrace_string();
|
||||
tf_printf("ERROR:\n%s\n", stack);
|
||||
@ -1058,16 +1056,16 @@ static void _startup(int argc, char* argv[])
|
||||
#endif
|
||||
|
||||
bool use_error_handler = false;
|
||||
#if defined(__ANDROID__)
|
||||
#if defined(__ANDROID__) || defined(_WIN32)
|
||||
use_error_handler = true;
|
||||
#endif
|
||||
if (use_error_handler)
|
||||
{
|
||||
if (
|
||||
#if !defined(_WIN32)
|
||||
signal(SIGSYS, _error_handler) == SIG_ERR || signal(SIGABRT, _error_handler) == SIG_ERR ||
|
||||
signal(SIGSYS, _error_handler) == SIG_ERR ||
|
||||
#endif
|
||||
signal(SIGSEGV, _error_handler) == SIG_ERR)
|
||||
signal(SIGABRT, _error_handler) == SIG_ERR || signal(SIGSEGV, _error_handler) == SIG_ERR)
|
||||
{
|
||||
perror("signal");
|
||||
}
|
||||
|
Reference in New Issue
Block a user