Skip to content

Commit

Permalink
Merge pull request #94079 from RandomShaper/editor_main_mq
Browse files Browse the repository at this point in the history
Let EditorLog use the right call queue for thread safety
  • Loading branch information
akien-mga committed Jul 8, 2024
2 parents 6deaa15 + 20298fb commit 16f98cd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
6 changes: 2 additions & 4 deletions editor/editor_log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ void EditorLog::_error_handler(void *p_self, const char *p_func, const char *p_f

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).call_deferred(err_str, message_type);
if (!Thread::is_main_thread()) {
MessageQueue::get_main_singleton()->push_callable(callable_mp(self, &EditorLog::add_message), err_str, message_type);
} else {
self->add_message(err_str, message_type);
}
Expand Down Expand Up @@ -557,8 +557,6 @@ EditorLog::EditorLog() {
eh.errfunc = _error_handler;
eh.userdata = this;
add_error_handler(&eh);

current = Thread::get_caller_id();
}

void EditorLog::deinit() {
Expand Down
2 changes: 0 additions & 2 deletions editor/editor_log.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,6 @@ class EditorLog : public HBoxContainer {

ErrorHandlerList eh;

Thread::ID current;

//void _dragged(const Point2& p_ofs);
void _meta_clicked(const String &p_meta);
void _clear_request();
Expand Down

0 comments on commit 16f98cd

Please sign in to comment.