From 47d601b3160c5ad77bc9de0145120c2a4ff372d7 Mon Sep 17 00:00:00 2001 From: jsjtxietian Date: Wed, 25 Oct 2023 14:47:25 +0800 Subject: [PATCH] Fix BaseButton.shortcut_feedback's timer raises errors when a button is removed from the scene tree --- scene/gui/base_button.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index f57afb66b30..66b14dc9671 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -380,7 +380,7 @@ void BaseButton::shortcut_input(const Ref &p_event) { queue_redraw(); accept_event(); - if (shortcut_feedback) { + if (shortcut_feedback && is_inside_tree()) { if (shortcut_feedback_timer == nullptr) { shortcut_feedback_timer = memnew(Timer); shortcut_feedback_timer->set_one_shot(true);