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

Prevent cache corruption when saving resources in the editor #74615

Conversation

YuriSizov
Copy link
Contributor

Fixes #74069.

See my comment there for what's going on and how this is not a GDScript module issue. Basically, I make sure that the editor doesn't handle resource saving too soon and that in turn prevents all of the following issues. This is a hack, and something that should be better addressed when we are going to rework EditorNode, but it prevents this crash for now, and it should also prevent some of those "Another resource is loaded from path" errors sometimes, I guess.

The change in GDScript is just cosmetic, a remnant of my investigation. But I did feel it made the method a bit clearer, so I kept it.

@YuriSizov YuriSizov added this to the 4.1 milestone Mar 8, 2023
@YuriSizov YuriSizov requested a review from a team March 8, 2023 18:51
@YuriSizov YuriSizov requested a review from a team as a code owner March 8, 2023 18:51
@fire
Copy link
Member

fire commented Mar 8, 2023

I'm not able to test it but the idea is pause the editor until imports are finished?

@YuriSizov
Copy link
Contributor Author

I'm not able to test it but the idea is pause the editor until imports are finished?

This is not related to imports, at least not directly. This is about saving Godot resources from inside of the editor, which currently triggers a rescan of the resource file immediately upon file creation. This PR delays it until after all the saving procedures have been performed. Nothing is paused, as this happens in milliseconds.

@fire
Copy link
Member

fire commented Mar 8, 2023

That logically makes sense. 👍

@akien-mga akien-mga merged commit c69ec65 into godotengine:master Mar 9, 2023
@akien-mga
Copy link
Member

Thanks!

@YuriSizov YuriSizov deleted the editor-prevent-corruption-when-saving-resources branch March 9, 2023 11:46
@YuriSizov
Copy link
Contributor Author

Cherry-picked for 4.0.1.

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

Successfully merging this pull request may close these issues.

Using "Save As" in script editor crashes with DEV_ENABLED (reference count below zero)
3 participants