Improve signal handling (fixes 87626)

Ammended to fix formatting issues
This commit is contained in:
Keaton Brown 2024-08-03 10:54:17 -05:00
parent 8a511ac79b
commit de6675e8aa
2 changed files with 9 additions and 12 deletions

View File

@ -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();

View File

@ -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