summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorHayden Leete <haydenleete@gmail.com>2023-03-08 19:22:58 +1300
committerYuri Sizov <yuris@humnom.net>2023-03-13 14:15:18 +0100
commit7490f892387662bc14b77b4992fe66a9c678fb5c (patch)
tree1d1489260bc071a1407bdd4140f494f3ea49a36b /editor
parent41f4068a6e81f5f0e94428ddc04330f6a154ee70 (diff)
Fix crash when revealing file in floating FileSystem Dock
When selecting "Show in FileSystem" from the context menu of a resource in the inspector, the engine would crash if the FileSystem dock was floating because it was trying to focus the FileSystem tab, but floating docks don't use Tab Containers. This commit makes the FileSystem dock's window grab focus instead if it's floating. (cherry picked from commit c4d1513e15e1f3e599030a98cf425177c3d1eb24)
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_resource_picker.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/editor/editor_resource_picker.cpp b/editor/editor_resource_picker.cpp
index 86ffbccefd..a83db21f20 100644
--- a/editor/editor_resource_picker.cpp
+++ b/editor/editor_resource_picker.cpp
@@ -399,8 +399,12 @@ void EditorResourcePicker::_edit_menu_cbk(int p_which) {
file_system_dock->navigate_to_path(edited_resource->get_path());
// Ensure that the FileSystem dock is visible.
- TabContainer *tab_container = (TabContainer *)file_system_dock->get_parent_control();
- tab_container->set_current_tab(tab_container->get_tab_idx_from_control(file_system_dock));
+ if (file_system_dock->get_window() == get_tree()->get_root()) {
+ TabContainer *tab_container = (TabContainer *)file_system_dock->get_parent_control();
+ tab_container->set_current_tab(tab_container->get_tab_idx_from_control(file_system_dock));
+ } else {
+ file_system_dock->get_window()->grab_focus();
+ }
} break;
default: {