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:
parent
a3753eda62
commit
2e86a5f929
|
@ -74,8 +74,9 @@ static uint32_t load_address() {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_crash(int sig) {
|
static void handle_crash(int sig) {
|
||||||
if (OS::get_singleton() == NULL)
|
if (OS::get_singleton() == NULL) {
|
||||||
return;
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
void *bt_buffer[256];
|
void *bt_buffer[256];
|
||||||
size_t size = backtrace(bt_buffer, 256);
|
size_t size = backtrace(bt_buffer, 256);
|
||||||
|
@ -157,6 +158,7 @@ CrashHandler::CrashHandler() {
|
||||||
}
|
}
|
||||||
|
|
||||||
CrashHandler::~CrashHandler() {
|
CrashHandler::~CrashHandler() {
|
||||||
|
disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CrashHandler::disable() {
|
void CrashHandler::disable() {
|
||||||
|
|
|
@ -45,8 +45,9 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
static void handle_crash(int sig) {
|
static void handle_crash(int sig) {
|
||||||
if (OS::get_singleton() == NULL)
|
if (OS::get_singleton() == NULL) {
|
||||||
return;
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
void *bt_buffer[256];
|
void *bt_buffer[256];
|
||||||
size_t size = backtrace(bt_buffer, 256);
|
size_t size = backtrace(bt_buffer, 256);
|
||||||
|
@ -115,6 +116,7 @@ CrashHandler::CrashHandler() {
|
||||||
}
|
}
|
||||||
|
|
||||||
CrashHandler::~CrashHandler() {
|
CrashHandler::~CrashHandler() {
|
||||||
|
disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CrashHandler::disable() {
|
void CrashHandler::disable() {
|
||||||
|
|
Loading…
Reference in New Issue