summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorYuri Sizov <yuris@humnom.net>2023-05-18 19:22:22 +0200
committerYuri Sizov <yuris@humnom.net>2023-05-18 19:22:22 +0200
commitfd8f38c240bf045ce2ba1891a9a68ff088234215 (patch)
treee358deee7d46451e9b198428b8e49c4bb8420c48 /editor
parent60e8a06d4eec393d0a2fc277bd66f080f55333b6 (diff)
Revert "Make EditorToaster's handler thread-safe"
This reverts commit 3a5bc7455eddd87feb8a70d3270a16c69a2c90f6.
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_toaster.cpp17
-rw-r--r--editor/editor_toaster.h1
2 files changed, 8 insertions, 10 deletions
diff --git a/editor/editor_toaster.cpp b/editor/editor_toaster.cpp
index 866a6db2a6..10c3e963af 100644
--- a/editor/editor_toaster.cpp
+++ b/editor/editor_toaster.cpp
@@ -145,12 +145,6 @@ void EditorToaster::_notification(int p_what) {
}
void EditorToaster::_error_handler(void *p_self, const char *p_func, const char *p_file, int p_line, const char *p_error, const char *p_errorexp, bool p_editor_notify, ErrorHandlerType p_type) {
- // This may be called from a thread. Since we will deal with non-thread-safe elements,
- // we have to put it in the queue for safety.
- callable_mp_static(&EditorToaster::_error_handler_impl).bind(p_file, p_line, p_error, p_errorexp, p_editor_notify, p_type).call_deferred();
-}
-
-void EditorToaster::_error_handler_impl(const String &p_file, int p_line, const String &p_error, const String &p_errorexp, bool p_editor_notify, int p_type) {
if (!EditorToaster::get_singleton() || !EditorToaster::get_singleton()->is_inside_tree()) {
return;
}
@@ -164,8 +158,13 @@ void EditorToaster::_error_handler_impl(const String &p_file, int p_line, const
int show_all_setting = EDITOR_GET("interface/editor/show_internal_errors_in_toast_notifications");
if (p_editor_notify || (show_all_setting == 0 && in_dev) || show_all_setting == 1) {
- String err_str = !p_errorexp.is_empty() ? p_errorexp : p_error;
- String tooltip_str = p_file + ":" + itos(p_line);
+ String err_str;
+ if (p_errorexp && p_errorexp[0]) {
+ err_str = String::utf8(p_errorexp);
+ } else {
+ err_str = String::utf8(p_error);
+ }
+ String tooltip_str = String::utf8(p_file) + ":" + itos(p_line);
if (!p_editor_notify) {
if (p_type == ERR_HANDLER_WARNING) {
@@ -175,7 +174,7 @@ void EditorToaster::_error_handler_impl(const String &p_file, int p_line, const
}
}
- Severity severity = ((ErrorHandlerType)p_type == ERR_HANDLER_WARNING) ? SEVERITY_WARNING : SEVERITY_ERROR;
+ Severity severity = (p_type == ERR_HANDLER_WARNING) ? SEVERITY_WARNING : SEVERITY_ERROR;
EditorToaster::get_singleton()->popup_str(err_str, severity, tooltip_str);
}
}
diff --git a/editor/editor_toaster.h b/editor/editor_toaster.h
index 4837756b4e..6b834f8288 100644
--- a/editor/editor_toaster.h
+++ b/editor/editor_toaster.h
@@ -89,7 +89,6 @@ private:
const double default_message_duration = 5.0;
static void _error_handler(void *p_self, const char *p_func, const char *p_file, int p_line, const char *p_error, const char *p_errorexp, bool p_editor_notify, ErrorHandlerType p_type);
- static void _error_handler_impl(const String &p_file, int p_line, const String &p_error, const String &p_errorexp, bool p_editor_notify, int p_type);
void _update_vbox_position();
void _update_disable_notifications_button();
void _auto_hide_or_free_toasts();