Skip to content

Commit

Permalink
Let EditorLog use the right call queue for thread safety
Browse files Browse the repository at this point in the history
This is a complement to f61c63e.
  • Loading branch information
RandomShaper committed Jul 8, 2024
1 parent ec02d40 commit 20298fb
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 20298fb

Please sign in to comment.