Fix various race conditions with capturing of script backtraces

This commit is contained in:
Mikael Hermansson 2025-06-02 18:15:10 +02:00
parent 64b09905c7
commit 6929823838
6 changed files with 44 additions and 47 deletions

View file

@ -146,14 +146,11 @@ static void handle_crash(int sig) {
print_error("-- END OF C++ BACKTRACE --");
print_error("================================================================");
if (ScriptServer::are_languages_initialized()) {
Vector<Ref<ScriptBacktrace>> script_backtraces = ScriptServer::capture_script_backtraces(false);
for (const Ref<ScriptBacktrace> &backtrace : script_backtraces) {
if (!backtrace->is_empty()) {
print_error(backtrace->format());
print_error(vformat("-- END OF %s BACKTRACE --", backtrace->get_language_name().to_upper()));
print_error("================================================================");
}
for (const Ref<ScriptBacktrace> &backtrace : ScriptServer::capture_script_backtraces(false)) {
if (!backtrace->is_empty()) {
print_error(backtrace->format());
print_error(vformat("-- END OF %s BACKTRACE --", backtrace->get_language_name().to_upper()));
print_error("================================================================");
}
}