Merge pull request #94079 from RandomShaper/editor_main_mq
Let EditorLog use the right call queue for thread safety
This commit is contained in:
commit
16f98cd707
|
@ -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;
|
MessageType message_type = p_type == ERR_HANDLER_WARNING ? MSG_TYPE_WARNING : MSG_TYPE_ERROR;
|
||||||
|
|
||||||
if (self->current != Thread::get_caller_id()) {
|
if (!Thread::is_main_thread()) {
|
||||||
callable_mp(self, &EditorLog::add_message).call_deferred(err_str, message_type);
|
MessageQueue::get_main_singleton()->push_callable(callable_mp(self, &EditorLog::add_message), err_str, message_type);
|
||||||
} else {
|
} else {
|
||||||
self->add_message(err_str, message_type);
|
self->add_message(err_str, message_type);
|
||||||
}
|
}
|
||||||
|
@ -557,8 +557,6 @@ EditorLog::EditorLog() {
|
||||||
eh.errfunc = _error_handler;
|
eh.errfunc = _error_handler;
|
||||||
eh.userdata = this;
|
eh.userdata = this;
|
||||||
add_error_handler(&eh);
|
add_error_handler(&eh);
|
||||||
|
|
||||||
current = Thread::get_caller_id();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorLog::deinit() {
|
void EditorLog::deinit() {
|
||||||
|
|
|
@ -156,8 +156,6 @@ private:
|
||||||
|
|
||||||
ErrorHandlerList eh;
|
ErrorHandlerList eh;
|
||||||
|
|
||||||
Thread::ID current;
|
|
||||||
|
|
||||||
//void _dragged(const Point2& p_ofs);
|
//void _dragged(const Point2& p_ofs);
|
||||||
void _meta_clicked(const String &p_meta);
|
void _meta_clicked(const String &p_meta);
|
||||||
void _clear_request();
|
void _clear_request();
|
||||||
|
|
Loading…
Reference in New Issue