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

Scene becomes corrupted or Godot crashes when renaming a scene that involves dependencies #80379

Closed
Tracked by #80877
ch0m5 opened this issue Aug 7, 2023 · 3 comments · Fixed by #80503
Closed
Tracked by #80877

Comments

@ch0m5
Copy link

ch0m5 commented Aug 7, 2023

Godot version

v4.1.stable.official [9704596]

System information

Godot v4.1.stable - Windows 10.0.22621 - Vulkan (Forward+) - dedicated AMD Radeon RX 7900 XTX (Advanced Micro Devices, Inc.; 31.0.21001.45002) - AMD Ryzen 7 7700X 8-Core Processor (16 Threads)

Issue description

When renaming a scene in specific conditions regarding inheritance, the scene is wrongly marked as corrupt or Godot just crashes.

The setup for the bug to happen involves having 3 scenes, one being within the other (forming a 1->2->3 order), having all 3 scenes opened in the editor, and then renaming the 3rd scene while scene 1 is open, causing the 2nd become corrupt or Godot to crash. This also occurs if the name of the folder where the 3rd scene is contained is changed, instead of the scene itself. I presume the path of the 3rd scene changing at all while the 1st scene is opened results in the bug.

Given that having multiple scenes with dependencies with each other seems to cause this bug, it is probable that his bug occurs beyond the aforementioned 3-scene setup, but it is a scenario where the bug can be consistently reproduced. It could be that the bug described in issue #80324 is related if not the same as the one described here.

Steps to reproduce

Empty Project:

  1. Create an empty Godot project.
  2. Create 3 scenes, each just being a Node. The contents of the scenes seem irrelevant beyond the dependencies explained in the following steps.
  3. Make the 2nd scene a child of the 1st, and the 3rd a child of the 2nd.
  4. Have all three of them opened, but have the 1st scene as the active one in the viewport.
  5. Rename the 3rd scene in the File System.

Minimal Reproduction Project:

  1. Open all 3 scenes in the project, but have the 1st scene as the active one in the viewport.
  2. Rename the 3rd scene in the File System OR the folder containing it. Either works.

The 2nd scene should now be marked as corrupt, and the user will be unable to open it until Godot has been restarted. Alternatively, Godot will have crashed.

Minimal reproduction project

Rename_Scene_Bug.zip

@Jordyfel
Copy link
Contributor

Jordyfel commented Aug 7, 2023

#79850 #77289

@OXTyler
Copy link
Contributor

OXTyler commented Aug 7, 2023

I can try to work on this, it sounds like a reference issue but im not 100%, where would this be handled in the code?

@saierXP
Copy link

saierXP commented Aug 8, 2023

Console error displays nc == 0(nodes.size()) when instantiating the scene.

ERROR: Cannot open file 'res://3.tscn'.
   at: (scene\resources\resource_format_text.cpp:1638)
ERROR: Failed loading resource: res://3.tscn. Make sure resources have been imported by opening the project in the editor at least once.
   at: (core\io\resource_loader.cpp:274)
ERROR: Method/function failed. Returning: err
   at: SceneState::pack (scene\resources\packed_scene.cpp:1033)
ERROR: Condition "nc == 0" is true. Returning: nullptr
   at: SceneState::instantiate (scene\resources\packed_scene.cpp:92)

The call stack displays the sdata returned when using ResourceLoader.load to load scene'2.tscn', the
The nodes size of the sdata.state is zero.
DbgX Shell_hU8LZRKb41

I can replicate it in 4.0.alpha1, restart the editor, or close Scene 1,Scene 3 which has been renamed, then Scene 2 can be reopened.

PS:If you right-click to rename a scene, it may sometimes crash due to another bug, but renaming with the shortcut F2 is not a problem.

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