summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-02-18 15:03:11 +0100
committerGitHub <noreply@github.com>2021-02-18 15:03:11 +0100
commit82033bf9b4ec90a59057bb3e6e1f405b9552277d (patch)
treecd96ca75ea870fe13e597283058ddd1df0330d34
parenta67a6a5a1819283a0f3eee62ef89fe1e83f7687b (diff)
parent7c6646c8acb98e8037cc7f4cc04ed1e38c7c602f (diff)
Merge pull request #46170 from gongpha/jr-_-avoid-get_tree-when-flying-colorpicker-master
Avoid signal methods in ColorPicker to access the tree when it isn't in the tree
-rw-r--r--scene/gui/color_picker.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp
index a3205c27a7..b82c078a2d 100644
--- a/scene/gui/color_picker.cpp
+++ b/scene/gui/color_picker.cpp
@@ -578,6 +578,10 @@ void ColorPicker::_preset_input(const Ref<InputEvent> &p_event) {
}
void ColorPicker::_screen_input(const Ref<InputEvent> &p_event) {
+ if (!is_inside_tree()) {
+ return;
+ }
+
Ref<InputEventMouseButton> bev = p_event;
if (bev.is_valid() && bev->get_button_index() == BUTTON_LEFT && !bev->is_pressed()) {
emit_signal("color_changed", color);
@@ -607,6 +611,10 @@ void ColorPicker::_add_preset_pressed() {
}
void ColorPicker::_screen_pick_pressed() {
+ if (!is_inside_tree()) {
+ return;
+ }
+
Viewport *r = get_tree()->get_root();
if (!screen) {
screen = memnew(Control);