浏览代码

Fix find_next_valid_focus() freeze

(cherry picked from commit 8d62b736b2fceb60a76ff916c8f904e25fece832)
kobewi 3 年之前
父节点
当前提交
14f69acaa4
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      scene/gui/control.cpp

+ 2 - 2
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;
 		}