diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp index 4f94f0d9f24..6e75be268df 100644 --- a/scene/gui/dialogs.cpp +++ b/scene/gui/dialogs.cpp @@ -38,8 +38,7 @@ // AcceptDialog void AcceptDialog::_input_from_window(const Ref &p_event) { - Ref key = p_event; - if (close_on_escape && key.is_valid() && key->is_action_pressed(SNAME("ui_cancel"), false, true)) { + if (close_on_escape && p_event->is_action_pressed(SNAME("ui_cancel"), false, true)) { _cancel_pressed(); } } diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp index c0a2dc81d0a..6915f3d2425 100644 --- a/scene/gui/popup.cpp +++ b/scene/gui/popup.cpp @@ -35,8 +35,7 @@ #include "scene/gui/panel.h" void Popup::_input_from_window(const Ref &p_event) { - Ref key = p_event; - if (get_flag(FLAG_POPUP) && key.is_valid() && key->is_action_pressed(SNAME("ui_cancel"), false, true)) { + if (get_flag(FLAG_POPUP) && p_event->is_action_pressed(SNAME("ui_cancel"), false, true)) { _close_pressed(); } }