Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editor freezes when modifying FileSystem's filter path when in Split Mode #87525

Closed
JNatheriver opened this issue Jan 24, 2024 · 5 comments · Fixed by #87563
Closed

Editor freezes when modifying FileSystem's filter path when in Split Mode #87525

JNatheriver opened this issue Jan 24, 2024 · 5 comments · Fixed by #87563

Comments

@JNatheriver
Copy link

Tested versions

  • Reproducible in: v4.2.1.stable.official [b09f793]

System information

Godot v4.2.1.stable - Windows 10.0.22621 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1050 (NVIDIA; 31.0.15.4617) - Intel(R) Core(TM) i5-9300H CPU @ 2.40GHz (8 Threads)

Issue description

While working on my project and navigating through folders in the FileSystem dock, I accidentally discovered a bug that causes Godot to crash. The crash can be triggered by either erasing the contents of the path field and then entering split mode or by erasing the contents while already in split mode and then pressing Enter. Considering the uncommon action of erasing path field content, not sure if worth reporting. New to game development and GitHub contributions.

Steps to reproduce

  1. Open Godot Editor.
  2. Navigate to the FileSystem dock.
  3. Select the path field within the FileSystem dock.
  4. Erase the contents of the path field.
  5. While still in split mode, press the Enter key.
  6. Observe the crash that occurs.
    2024-01-23 22-49-16

OR

  1. Open Godot Editor.
  2. Navigate to the FileSystem dock.
  3. Select the path field within the FileSystem dock.
  4. Erase the contents of the path field.
  5. Switch to split mode.
  6. Observe the crash that occurs.
    2024-01-23 22-55-38

Minimal reproduction project (MRP)

N/A

@kleonc
Copy link
Member

kleonc commented Jan 24, 2024

Tested, it's not crashing, it freezes.

Can't reproduce in:

  • v3.5.3.stable.official [6c81413]
  • v3.6.beta3.official [21ab700]
  • v4.0.4.stable.official [fc0b241]
  • v4.1.3.stable.official [f06b6836a]
  • v4.2.dev3.official [013e8e3]

Can reproduce in v4.2.dev4.official [549fcce] and newer.

It's a regression from #80440. Specifically this is the infinite loop causing the freeze (directory starts as an empty string):

Color inherited_folder_color = default_folder_color;
String color_scan_dir = directory;
while (color_scan_dir != "res://" && inherited_folder_color == default_folder_color) {
if (!color_scan_dir.ends_with("/")) {
color_scan_dir += "/";
}
if (assigned_folder_colors.has(color_scan_dir)) {
inherited_folder_color = folder_colors[assigned_folder_colors[color_scan_dir]];
}
color_scan_dir = color_scan_dir.rstrip("/").get_base_dir();
}

This preceding part (not a part of #80440) seems problematic:

if (!efd) {
directory = current_path.get_base_dir();
file = current_path.get_file();
efd = EditorFileSystem::get_singleton()->get_filesystem_path(directory);
}
if (!efd) {
return;
}

because EditorFileSystem::get_filesystem_path seems to resolve an empty path as the project root directory, making efd above be not null and hence not aborting further execution. But directory ends up still being an empty path.


Considering the uncommon action of erasing path field content, not sure if worth reporting. New to game development and GitHub contributions.

Any bug is worth being reported, regardless of its rarity. Crashes/freezes are especially frustrating so this report is definitely wanted, thanks! 🙂

@kleonc kleonc changed the title Crash in Godot Editor when Modifying Path Field in Split Mode Editor freezes when modifying FileSystem's filter path to empty string Jan 24, 2024
@kleonc kleonc changed the title Editor freezes when modifying FileSystem's filter path to empty string Editor freezes when modifying FileSystem's filter path to empty string when in Split Mode Jan 24, 2024
@kleonc kleonc changed the title Editor freezes when modifying FileSystem's filter path to empty string when in Split Mode Editor freezes when modifying FileSystem's filter path when in Split Mode Jan 24, 2024
@YuriSizov
Copy link
Contributor

YuriSizov commented Jan 24, 2024

Did you test 4.3 builds? By this description I think this was fixed already by #86171

Edit: Wait, nevermind, it's a different file.

@kleonc
Copy link
Member

kleonc commented Jan 24, 2024

Did you test 4.3 builds?

I've run it with like a week-old master build to see where it's getting stuck at. Not with the latest master though.

@jsjtxietian
Copy link
Contributor

Did you test 4.3 builds?

I can confirm it happens at current master.

The whole code here seems to assume the directory is always starts with "res://" instead of empty one.

@KoBeWi
Copy link
Member

KoBeWi commented Jan 27, 2024

The problematic field is not a filter path, it's a path to the selected file. It's likely meant to navigate to folders by name or for copying the current path, but there are better ways to do both, so I wonder if anyone is even using this field. We could make it uneditable or even remove it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants