summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorIbrahn Sahir <ibrahn.sahir@gmail.com>2018-09-24 22:21:05 +0100
committerIbrahn Sahir <ibrahn.sahir@gmail.com>2018-09-24 22:21:05 +0100
commit653b8324223414002e198eb2a8a685903186b97e (patch)
tree6f43888723996f7a2aa9eb31900e46d2aad1cf38 /platform
parentc432ce4ee15fc396b2bccbbe2661b5bd34b9bee1 (diff)
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.
Diffstat (limited to 'platform')
-rw-r--r--platform/osx/crash_handler_osx.mm6
-rw-r--r--platform/x11/crash_handler_x11.cpp6
2 files changed, 8 insertions, 4 deletions
diff --git a/platform/osx/crash_handler_osx.mm b/platform/osx/crash_handler_osx.mm
index 9ad3437f0f..490155bb24 100644
--- a/platform/osx/crash_handler_osx.mm
+++ b/platform/osx/crash_handler_osx.mm
@@ -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() {
diff --git a/platform/x11/crash_handler_x11.cpp b/platform/x11/crash_handler_x11.cpp
index ab9275e49f..79c3d9aece 100644
--- a/platform/x11/crash_handler_x11.cpp
+++ b/platform/x11/crash_handler_x11.cpp
@@ -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() {