godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
86.64k stars 19.32k forks source link

Godot crashes during launch when editor_settings.tres is corrupted #93465

Open CookieBadger opened 2 weeks ago

CookieBadger commented 2 weeks ago

Tested versions

4.3-beta2

System information

Windows 10

Issue description

After a crash, my editor_settings.tres file ended up being corrupted (full of NULs, see attachment). If I try to restart the editor, it will crash shortly after, displaying the following errors:

ERROR: C:/Users/.../AppData/Roaming/Godot/editor_settings-4.3.tres:1 - Parse Error:
at: open (scene/resources/resource_format_text.cpp:1056)
ERROR: Failed loading resource: C:/Users/.../AppData/Roaming/Godot/editor_settings-4.3.tres. Make sure resources have been imported by opening the project in the editor at least once.
at: (core/io/resourcer_loader.cpp:281)

========================================
CrashHandlerException: Program crashed with signal 11
[...]
[1] error(-1): no debug info in PE/COFF executable
[...]

Steps to reproduce

Difficult to reproduce since it requires a crash that corrupts the editor_settings.tres file, but you can replace yours with the attached corrupt one, and then try launch the editor.

Minimal reproduction project (MRP)

editor_settings-4.3.zip

AThousandShips commented 2 weeks ago

The question is how we should solve this, we could just make a graceful exit instead with an error

Otherwise I think we shouldn't just wipe the settings when corrupted, my suggestion would be to add a dialog that asks you what you want to do and offer to:

Maybe also a "safe" mode where you can open without reading or writing to the file

But I think the basic step should not be to reset the file unprompted

CookieBadger commented 2 weeks ago

Yes, I think you make a good point, and I like your suggestions about letting the user decide. I think it's also important to be very descriptive about what this file even is, as the average user might not even be aware that Godot saves preferences in AppData.

Is there already something in place for displaying a popup before the project manager or before the editor launches?

AThousandShips commented 2 weeks ago

Not sure exactly about that specific case, would need some evaluation