Skip to content

Commit

Permalink
Merge pull request #77080 from KoBeWi/spam_error_log_with_multiple_th…
Browse files Browse the repository at this point in the history
…reads_for_better_spam_efficiency

Allow showing messages from threads in Editor Log
  • Loading branch information
akien-mga committed May 16, 2023
2 parents accb57d + 61465ee commit 965db42
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions editor/editor_log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@

void EditorLog::_error_handler(void *p_self, const char *p_func, const char *p_file, int p_line, const char *p_error, const char *p_errorexp, bool p_editor_notify, ErrorHandlerType p_type) {
EditorLog *self = static_cast<EditorLog *>(p_self);
if (self->current != Thread::get_caller_id()) {
return;
}

String err_str;
if (p_errorexp && p_errorexp[0]) {
Expand All @@ -58,10 +55,12 @@ void EditorLog::_error_handler(void *p_self, const char *p_func, const char *p_f
err_str += " (User)";
}

if (p_type == ERR_HANDLER_WARNING) {
self->add_message(err_str, MSG_TYPE_WARNING);
MessageType message_type = p_type == ERR_HANDLER_WARNING ? MSG_TYPE_WARNING : MSG_TYPE_ERROR;

if (self->current != Thread::get_caller_id()) {
callable_mp(self, &EditorLog::add_message).bind(err_str, message_type).call_deferred();
} else {
self->add_message(err_str, MSG_TYPE_ERROR);
self->add_message(err_str, message_type);
}
}

Expand Down

0 comments on commit 965db42

Please sign in to comment.