app: auto-backup of current work-in-progress images during a crash.
As previously explained, this was the next and logical step after debugging. At the very end, just before exiting the process, let's attempt to save all unsaved (i.e. "dirty") images. Of course we try to do so as backup files in the config directory (once again, this would be better under $XDG_CACHE_HOME/GIMP/ though) because we must not touch the originals. Currently we only have some automatic saving, but we don't warn yet that backups were made. Also we don't keep track of the original paths for later recovery hints. Proposed recovery would be worth being done at next start of GIMP when we detect files in the backup directory (with a typical "What should we do with these?" dialog). Also it is to be noted that it is not a 100%-sure system. While testing various test cases, I had many cases where the images were successfully saved, but others when the backup failed (in particular when playing with double freeing). I'm not sure if this is because of some memory allocation during XCF saving or some other issue which could be improved later (hopefully).
Showing with 73 additions and 3 deletions