Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid editor error reporting using resource loader thread's call queues #92426

Merged
merged 1 commit into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/io/resource_loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ class ResourceLoader {
// Loaders can safely use this regardless which thread they are running on.
static void notify_load_error(const String &p_err) {
if (err_notify) {
callable_mp_static(err_notify).call_deferred(p_err);
MessageQueue::get_main_singleton()->push_callable(callable_mp_static(err_notify).bind(p_err));
AThousandShips marked this conversation as resolved.
Show resolved Hide resolved
}
}
static void set_error_notify_func(ResourceLoadErrorNotify p_err_notify) {
Expand All @@ -239,7 +239,7 @@ class ResourceLoader {
if (Thread::get_caller_id() == Thread::get_main_id()) {
dep_err_notify(p_path, p_dependency, p_type);
} else {
callable_mp_static(dep_err_notify).call_deferred(p_path, p_dependency, p_type);
MessageQueue::get_main_singleton()->push_callable(callable_mp_static(dep_err_notify).bind(p_path, p_dependency, p_type));
}
}
}
Expand Down
1 change: 1 addition & 0 deletions core/object/message_queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ class MessageQueue : public CallQueue {

public:
_FORCE_INLINE_ static CallQueue *get_singleton() { return thread_singleton ? thread_singleton : main_singleton; }
_FORCE_INLINE_ static CallQueue *get_main_singleton() { return main_singleton; }

static void set_thread_singleton_override(CallQueue *p_thread_singleton);

Expand Down
2 changes: 1 addition & 1 deletion editor/gui/editor_toaster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ void EditorToaster::popup_str(const String &p_message, Severity p_severity, cons
// Since "_popup_str" adds nodes to the tree, and since the "add_child" method is not
// thread-safe, it's better to defer the call to the next cycle to be thread-safe.
is_processing_error = true;
callable_mp(this, &EditorToaster::_popup_str).call_deferred(p_message, p_severity, p_tooltip);
MessageQueue::get_main_singleton()->push_callable(callable_mp(this, &EditorToaster::_popup_str).bind(p_message, p_severity, p_tooltip));
is_processing_error = false;
}

Expand Down
Loading