From 14f69acaa4ef80b235ef78f9caac1072daf8008b Mon Sep 17 00:00:00 2001 From: kobewi Date: Fri, 1 Jul 2022 00:25:10 +0200 Subject: [PATCH] Fix find_next_valid_focus() freeze (cherry picked from commit 8d62b736b2fceb60a76ff916c8f904e25fece832) --- scene/gui/control.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 21ff052a3f3..e8f3d581aca 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -1903,7 +1903,7 @@ Control *Control::find_next_valid_focus() const { } } - if (next_child == from) { // No next control. + if (next_child == from || next_child == this) { // No next control. return (get_focus_mode() == FOCUS_ALL) ? next_child : nullptr; } if (next_child) { @@ -1987,7 +1987,7 @@ Control *Control::find_prev_valid_focus() const { } } - if (prev_child == from) { // No prev control. + if (prev_child == from || prev_child == this) { // No prev control. return (get_focus_mode() == FOCUS_ALL) ? prev_child : nullptr; }