Fixed hang when segfaulting after OS object destroyed (OSX and X11)

The two POSIX style crash handlers (OSX and X11) now remove their signal
handlers when they are destroyed.
Additonally if they are called while no OS singleton is set, they will
simply abort(). This should not happen now that they remove themselves,
but if a future change seperates OS object and crash handler lifetimes,
this may be easier to report/debug than hanging on SIGSEGV.
This commit is contained in:
Ibrahn Sahir 2018-09-24 22:21:05 +01:00
parent c432ce4ee1
commit 653b832422
2 changed files with 8 additions and 4 deletions

View file

@ -68,8 +68,9 @@ static uint64_t load_address() {
}
static void handle_crash(int sig) {
if (OS::get_singleton() == NULL)
return;
if (OS::get_singleton() == NULL) {
abort();
}
void *bt_buffer[256];
size_t size = backtrace(bt_buffer, 256);
@ -151,6 +152,7 @@ CrashHandler::CrashHandler() {
}
CrashHandler::~CrashHandler() {
disable();
}
void CrashHandler::disable() {

View file

@ -45,8 +45,9 @@
#include <stdlib.h>
static void handle_crash(int sig) {
if (OS::get_singleton() == NULL)
return;
if (OS::get_singleton() == NULL) {
abort();
}
void *bt_buffer[256];
size_t size = backtrace(bt_buffer, 256);
@ -119,6 +120,7 @@ CrashHandler::CrashHandler() {
}
CrashHandler::~CrashHandler() {
disable();
}
void CrashHandler::disable() {