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

Crash during overwrite nukes the existing file #217

Open
pasbi opened this issue Dec 11, 2021 · 0 comments
Open

Crash during overwrite nukes the existing file #217

pasbi opened this issue Dec 11, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@pasbi
Copy link
Owner

pasbi commented Dec 11, 2021

Describe the bug
When saving the scene to some existing file (i.e., attempting to overwrite it) and the application crashes during the serialization,
that file will be empty.
That is because a ofstream to that file is opened first (which already erases the content), then the serialization happens into a buffer, then the buffer is written to the ofstream.

To Reproduce
Steps to reproduce the behavior:

  1. Create some scene (from scratch or load it)
  2. File -> Save As -> pick existing file (i.e., attempt to overwrite it) and make sure that omm crashes within the serialization code. (Note: That crash is not part of this bug report. Any crash during serialization will do. If you just want to reproduce: put an abort into the serialization code)
  3. The file is empty now.

Expected behavior
Losing the work we just wanted to save is super annoying already, but losing the work before, too, is even worse.
I would expect that the overwritten file contains either the most recent save, or at least was not touched if something crashes.

Desktop (please complete the following information):
This problem seems to be independent of the system.

Additional context
The bug should be easy to resolve.
The serialization is stored in a buffer already.
Don't open the file (or stream, whatever), until that serialization has finished without errors.
Then put the buffer into that file/stream and close it.

@pasbi pasbi added the bug Something isn't working label Dec 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant