Skip to content

Commit 9738ed5

Browse files
authored
Merge pull request godotengine#29134 from ibrahn/fix-crashhandler-msg-lookup
Check project settings live before lookup in crash handler
2 parents 7c73a74 + 63068e2 commit 9738ed5

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

platform/osx/crash_handler_osx.mm

+6-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,12 @@ static void handle_crash(int sig) {
7777
void *bt_buffer[256];
7878
size_t size = backtrace(bt_buffer, 256);
7979
String _execpath = OS::get_singleton()->get_executable_path();
80-
String msg = GLOBAL_GET("debug/settings/crash_handler/message");
80+
81+
String msg;
82+
const ProjectSettings *proj_settings = ProjectSettings::get_singleton();
83+
if (proj_settings) {
84+
msg = proj_settings->get("debug/settings/crash_handler/message");
85+
}
8186

8287
// Dump the backtrace to stderr with a message to the user
8388
fprintf(stderr, "%s: Program crashed with signal %d\n", __FUNCTION__, sig);

platform/windows/crash_handler_windows.cpp

+7-2
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,16 @@ DWORD CrashHandlerException(EXCEPTION_POINTERS *ep) {
166166
line.SizeOfStruct = sizeof(line);
167167
IMAGE_NT_HEADERS *h = ImageNtHeader(base);
168168
DWORD image_type = h->FileHeader.Machine;
169-
int n = 0;
170-
String msg = GLOBAL_GET("debug/settings/crash_handler/message");
169+
170+
String msg;
171+
const ProjectSettings *proj_settings = ProjectSettings::get_singleton();
172+
if (proj_settings) {
173+
msg = proj_settings->get("debug/settings/crash_handler/message");
174+
}
171175

172176
fprintf(stderr, "Dumping the backtrace. %ls\n", msg.c_str());
173177

178+
int n = 0;
174179
do {
175180
if (skip_first) {
176181
skip_first = false;

platform/x11/crash_handler_x11.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,12 @@ static void handle_crash(int sig) {
5353
void *bt_buffer[256];
5454
size_t size = backtrace(bt_buffer, 256);
5555
String _execpath = OS::get_singleton()->get_executable_path();
56-
String msg = GLOBAL_GET("debug/settings/crash_handler/message");
56+
57+
String msg;
58+
const ProjectSettings *proj_settings = ProjectSettings::get_singleton();
59+
if (proj_settings) {
60+
msg = proj_settings->get("debug/settings/crash_handler/message");
61+
}
5762

5863
// Dump the backtrace to stderr with a message to the user
5964
fprintf(stderr, "%s: Program crashed with signal %d\n", __FUNCTION__, sig);

0 commit comments

Comments
 (0)