You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-16 14:00:40 +00:00
Prevent infinite recursion during printing
This commit is contained in:
@@ -233,12 +233,10 @@ void Logger::log_message(const String &p_text, bool p_error) {
|
||||
////// OS //////
|
||||
|
||||
void OS::LoggerBind::logv(const char *p_format, va_list p_list, bool p_err) {
|
||||
if (!should_log(p_err) || is_logging) {
|
||||
if (!should_log(p_err)) {
|
||||
return;
|
||||
}
|
||||
|
||||
is_logging = true;
|
||||
|
||||
constexpr int static_buf_size = 1024;
|
||||
char static_buf[static_buf_size] = { '\0' };
|
||||
char *buf = static_buf;
|
||||
@@ -260,12 +258,10 @@ void OS::LoggerBind::logv(const char *p_format, va_list p_list, bool p_err) {
|
||||
if (len >= static_buf_size) {
|
||||
Memory::free_static(buf);
|
||||
}
|
||||
|
||||
is_logging = false;
|
||||
}
|
||||
|
||||
void OS::LoggerBind::log_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, bool p_editor_notify, ErrorType p_type, const Vector<Ref<ScriptBacktrace>> &p_script_backtraces) {
|
||||
if (!should_log(true) || is_logging) {
|
||||
if (!should_log(true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -275,13 +271,9 @@ void OS::LoggerBind::log_error(const char *p_function, const char *p_file, int p
|
||||
backtraces[i] = p_script_backtraces[i];
|
||||
}
|
||||
|
||||
is_logging = true;
|
||||
|
||||
for (Ref<CoreBind::Logger> &logger : loggers) {
|
||||
logger->log_error(p_function, p_file, p_line, p_code, p_rationale, p_editor_notify, CoreBind::Logger::ErrorType(p_type), backtraces);
|
||||
}
|
||||
|
||||
is_logging = false;
|
||||
}
|
||||
|
||||
PackedByteArray OS::get_entropy(int p_bytes) {
|
||||
|
||||
Reference in New Issue
Block a user