From de6675e8aa3956e06267a2bf72dcbb2b0444f019 Mon Sep 17 00:00:00 2001 From: Keaton Brown Date: Sat, 3 Aug 2024 10:54:17 -0500 Subject: [PATCH] Improve signal handling (fixes 87626) Ammended to fix formatting issues --- scene/gui/popup.cpp | 14 +++++++------- tests/scene/test_popup.h | 7 ++----- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp index 3b684aacf49..d6f3586e79a 100644 --- a/scene/gui/popup.cpp +++ b/scene/gui/popup.cpp @@ -71,14 +71,14 @@ void Popup::_deinitialize_visible_parents() { if (is_embedded()) { for (Window *parent_window : visible_parents) { Callable focus_entered_callable = callable_mp(this, &Popup::_parent_focused); - Callable tree_exited_callable = callable_mp(this, &Popup::_deinitialize_visible_parents); + Callable tree_exited_callable = callable_mp(this, &Popup::_deinitialize_visible_parents); - if (parent_window->is_connected(SceneStringName(focus_entered), focus_entered_callable)) { - parent_window->disconnect(SceneStringName(focus_entered), focus_entered_callable); - } - if (parent_window->is_connected(SceneStringName(tree_exited), tree_exited_callable)) { - parent_window->disconnect(SceneStringName(tree_exited), tree_exited_callable); - } + if (parent_window->is_connected(SceneStringName(focus_entered), focus_entered_callable)) { + parent_window->disconnect(SceneStringName(focus_entered), focus_entered_callable); + } + if (parent_window->is_connected(SceneStringName(tree_exited), tree_exited_callable)) { + parent_window->disconnect(SceneStringName(tree_exited), tree_exited_callable); + } } visible_parents.clear(); diff --git a/tests/scene/test_popup.h b/tests/scene/test_popup.h index 955721ce570..5b1d6c65e6e 100644 --- a/tests/scene/test_popup.h +++ b/tests/scene/test_popup.h @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_viewport.h */ +/* test_popup.h */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -31,15 +31,13 @@ #ifndef TEST_POPUP_H #define TEST_POPUP_H -#include "scene/gui/popup.h" #include "scene/gui/control.h" +#include "scene/gui/popup.h" #include "scene/main/window.h" -#include "core/object/worker_thread_pool.h" #include "tests/test_macros.h" #include "tests/test_tools.h" - namespace TestPopup { TEST_CASE("[SceneTree][Popup]") { @@ -67,7 +65,6 @@ TEST_CASE("[SceneTree][Popup]") { CHECK_FALSE(ed.has_error); ed.clear(); } - } } // namespace TestPopup