mirror of
https://github.com/godotengine/godot.git
synced 2024-11-22 20:23:53 +00:00
Check project settings live before lookup in crash handler
In x11, windows and osx crash handlers, check project settings exists before looking up the crash handler message setting. Avoids crashing the crash handler when handling a crash outside project settings lifetime. Instead omitting the configurable message and continuing with trace dump.
This commit is contained in:
parent
7c73a741f3
commit
63068e2ccd
@ -77,7 +77,12 @@ static void handle_crash(int sig) {
|
|||||||
void *bt_buffer[256];
|
void *bt_buffer[256];
|
||||||
size_t size = backtrace(bt_buffer, 256);
|
size_t size = backtrace(bt_buffer, 256);
|
||||||
String _execpath = OS::get_singleton()->get_executable_path();
|
String _execpath = OS::get_singleton()->get_executable_path();
|
||||||
String msg = GLOBAL_GET("debug/settings/crash_handler/message");
|
|
||||||
|
String msg;
|
||||||
|
const ProjectSettings *proj_settings = ProjectSettings::get_singleton();
|
||||||
|
if (proj_settings) {
|
||||||
|
msg = proj_settings->get("debug/settings/crash_handler/message");
|
||||||
|
}
|
||||||
|
|
||||||
// Dump the backtrace to stderr with a message to the user
|
// Dump the backtrace to stderr with a message to the user
|
||||||
fprintf(stderr, "%s: Program crashed with signal %d\n", __FUNCTION__, sig);
|
fprintf(stderr, "%s: Program crashed with signal %d\n", __FUNCTION__, sig);
|
||||||
|
@ -166,11 +166,16 @@ DWORD CrashHandlerException(EXCEPTION_POINTERS *ep) {
|
|||||||
line.SizeOfStruct = sizeof(line);
|
line.SizeOfStruct = sizeof(line);
|
||||||
IMAGE_NT_HEADERS *h = ImageNtHeader(base);
|
IMAGE_NT_HEADERS *h = ImageNtHeader(base);
|
||||||
DWORD image_type = h->FileHeader.Machine;
|
DWORD image_type = h->FileHeader.Machine;
|
||||||
int n = 0;
|
|
||||||
String msg = GLOBAL_GET("debug/settings/crash_handler/message");
|
String msg;
|
||||||
|
const ProjectSettings *proj_settings = ProjectSettings::get_singleton();
|
||||||
|
if (proj_settings) {
|
||||||
|
msg = proj_settings->get("debug/settings/crash_handler/message");
|
||||||
|
}
|
||||||
|
|
||||||
fprintf(stderr, "Dumping the backtrace. %ls\n", msg.c_str());
|
fprintf(stderr, "Dumping the backtrace. %ls\n", msg.c_str());
|
||||||
|
|
||||||
|
int n = 0;
|
||||||
do {
|
do {
|
||||||
if (skip_first) {
|
if (skip_first) {
|
||||||
skip_first = false;
|
skip_first = false;
|
||||||
|
@ -53,7 +53,12 @@ static void handle_crash(int sig) {
|
|||||||
void *bt_buffer[256];
|
void *bt_buffer[256];
|
||||||
size_t size = backtrace(bt_buffer, 256);
|
size_t size = backtrace(bt_buffer, 256);
|
||||||
String _execpath = OS::get_singleton()->get_executable_path();
|
String _execpath = OS::get_singleton()->get_executable_path();
|
||||||
String msg = GLOBAL_GET("debug/settings/crash_handler/message");
|
|
||||||
|
String msg;
|
||||||
|
const ProjectSettings *proj_settings = ProjectSettings::get_singleton();
|
||||||
|
if (proj_settings) {
|
||||||
|
msg = proj_settings->get("debug/settings/crash_handler/message");
|
||||||
|
}
|
||||||
|
|
||||||
// Dump the backtrace to stderr with a message to the user
|
// Dump the backtrace to stderr with a message to the user
|
||||||
fprintf(stderr, "%s: Program crashed with signal %d\n", __FUNCTION__, sig);
|
fprintf(stderr, "%s: Program crashed with signal %d\n", __FUNCTION__, sig);
|
||||||
|
Loading…
Reference in New Issue
Block a user