diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-11-01 09:37:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-01 09:37:11 +0100 |
commit | efbbd14af3f3325c4201518528e7acb93d60098a (patch) | |
tree | 4a4585c9421d7da1520956d7d6282aa8d4c12d64 | |
parent | 0b667e6c277f4567eb0e915a0264f0e2c9124851 (diff) | |
parent | 3d9c5648df630a3218f5b7b0ed236b93701cf648 (diff) |
Merge pull request #54443 from briansemrau/threadsafe-toast
Make editor toasts threadsafe
-rw-r--r-- | editor/editor_toaster.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/editor/editor_toaster.cpp b/editor/editor_toaster.cpp index 9de0ea40fe..22da12b59b 100644 --- a/editor/editor_toaster.cpp +++ b/editor/editor_toaster.cpp @@ -172,10 +172,11 @@ void EditorToaster::_error_handler(void *p_self, const char *p_func, const char } } - if (p_type == ERR_HANDLER_WARNING) { - EditorToaster::get_singleton()->popup_str(err_str, SEVERITY_WARNING, tooltip_str); + Severity severity = (p_type == ERR_HANDLER_WARNING) ? SEVERITY_WARNING : SEVERITY_ERROR; + if (Thread::get_caller_id() != Thread::get_main_id()) { + EditorToaster::get_singleton()->call_deferred(SNAME("popup_str"), err_str, severity, tooltip_str); } else { - EditorToaster::get_singleton()->popup_str(err_str, SEVERITY_ERROR, tooltip_str); + EditorToaster::get_singleton()->popup_str(err_str, severity, tooltip_str); } } } |