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.

(cherry picked from commit 653b832422)
This commit is contained in:
Ibrahn Sahir 2018-09-24 22:21:05 +01:00 committed by Rémi Verschelde
parent a3753eda62
commit 2e86a5f929
2 changed files with 8 additions and 4 deletions

View File

@ -74,8 +74,9 @@ static uint32_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);
@ -157,6 +158,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);
@ -115,6 +116,7 @@ CrashHandler::CrashHandler() {
}
CrashHandler::~CrashHandler() {
disable();
}
void CrashHandler::disable() {