Skip to content

Commit

Permalink
Merge pull request #91090 from timothyqiu/disconnect
Browse files Browse the repository at this point in the history
Fix error when moving FileSystem dock
  • Loading branch information
akien-mga committed Apr 24, 2024
2 parents dcdaa7d + 308fb3a commit 2da707e
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions editor/gui/editor_dir_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,23 +117,13 @@ void EditorDirDialog::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
FileSystemDock::get_singleton()->connect("folder_color_changed", callable_mp(this, &EditorDirDialog::reload).bind(""));

EditorFileSystem::get_singleton()->connect("filesystem_changed", callable_mp(this, &EditorDirDialog::reload).bind(""));
reload();

if (!tree->is_connected("item_collapsed", callable_mp(this, &EditorDirDialog::_item_collapsed))) {
tree->connect("item_collapsed", callable_mp(this, &EditorDirDialog::_item_collapsed), CONNECT_DEFERRED);
}

if (!EditorFileSystem::get_singleton()->is_connected("filesystem_changed", callable_mp(this, &EditorDirDialog::reload))) {
EditorFileSystem::get_singleton()->connect("filesystem_changed", callable_mp(this, &EditorDirDialog::reload).bind(""));
}
} break;

case NOTIFICATION_EXIT_TREE: {
if (EditorFileSystem::get_singleton()->is_connected("filesystem_changed", callable_mp(this, &EditorDirDialog::reload))) {
EditorFileSystem::get_singleton()->disconnect("filesystem_changed", callable_mp(this, &EditorDirDialog::reload));
}
EditorFileSystem::get_singleton()->disconnect("filesystem_changed", callable_mp(this, &EditorDirDialog::reload));
FileSystemDock::get_singleton()->disconnect("folder_color_changed", callable_mp(this, &EditorDirDialog::reload));
} break;

case NOTIFICATION_VISIBILITY_CHANGED: {
Expand Down Expand Up @@ -229,6 +219,7 @@ EditorDirDialog::EditorDirDialog() {
vb->add_child(tree);
tree->set_v_size_flags(Control::SIZE_EXPAND_FILL);
tree->connect("item_activated", callable_mp(this, &EditorDirDialog::_item_activated));
tree->connect("item_collapsed", callable_mp(this, &EditorDirDialog::_item_collapsed), CONNECT_DEFERRED);

set_ok_button_text(TTR("Move"));

Expand Down

0 comments on commit 2da707e

Please sign in to comment.