Orama-Interactive/Pixelorama

An empty 0B pxo file is saved if Pixelorama crashes during saving

OverloadedOrama opened this issue · 0 comments

Pixelorama version:
v0.10.3 and v0.11-dev (latest master), most likely previous versions too.

OS/device including version:
OpenSUSE Tumbleweed, but it has been reported on Windows 10 Pro as well.

Issue description:
Related to #762, but I decided to keep these issues separate, as even if #762 is fixed, more situations causing crashes may linger. The issue is that, if Pixelorama crashes during saving, a 0B pxo file is being saved, which replaces the previous pxo file with the same file name on the same folder, if it exists. This is a serious issue because it can result to data loss.

An idea I had to solve the issue would be to check if a file with the same name exists, and if it does, save the pxo with a different file name. If that is saved successfully, we then rename it, replacing the previous pxo file.

Steps to reproduce:
You can follow #762's steps to reproduce to cause a crash.