summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilles Roudière <gilles.roudiere@gmail.com>2021-10-19 17:18:45 +0200
committerGilles Roudière <gilles.roudiere@gmail.com>2021-10-19 17:18:45 +0200
commit20f4dce7a06cf5bf33141800a395587662d5b600 (patch)
treeb78285b64a58de4271b76b4a165c6f95a69ebcbf
parentbc0b7028742fbb337d7549f49460a726fb2930b4 (diff)
Fix EditorToaster constant update and prevent a crash
-rw-r--r--editor/editor_toaster.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/editor/editor_toaster.cpp b/editor/editor_toaster.cpp
index 0d45a7f1d8..9de0ea40fe 100644
--- a/editor/editor_toaster.cpp
+++ b/editor/editor_toaster.cpp
@@ -35,7 +35,7 @@
#include "editor_toaster.h"
-EditorToaster *EditorToaster::singleton;
+EditorToaster *EditorToaster::singleton = nullptr;
void EditorToaster::_notification(int p_what) {
switch (p_what) {
@@ -90,8 +90,10 @@ void EditorToaster::_notification(int p_what) {
// Hide element if it is not visible anymore.
if (modulate.a <= 0) {
- element.key->hide();
- needs_update = true;
+ if (element.key->is_visible()) {
+ element.key->hide();
+ needs_update = true;
+ }
}
}
@@ -141,7 +143,7 @@ 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) {
- if (!EditorToaster::get_singleton()) {
+ if (!EditorToaster::get_singleton() || !EditorToaster::get_singleton()->is_inside_tree()) {
return;
}