Warn before overwriting newer version of file

Migrated from https://bugs.launchpad.net/inkscape/+bug/1760861

I recently lost quite a bit of work by overwriting my more recently-saved file with an older one that had been open for days in another Inkscape session in another workspace. My fault. But I know this could've been avoided had there been a few warnings.

Steps to reproduce:

  1. Save an SVG file in Inkscape (instance-1): a.svg
  2. Open a.svg in another Inkscape instance (instance-2)
  3. Switch to instance-1.
  4. Modify a.svg in instance-1 and save it.
  5. Switch to instance-2.
  6. Modify a.svg in instance-2 and save it.
  7. Changes from step 4 are lost.

What happened?

  • At step 2, Inkscape allows file to be opened without any indication that it has been opened elsewhere.
  • At step 5, Inkscape isn't aware that the file has been modified elsewhere.
  • At step 6, Inkscape allows overwriting the file without any warning.

What should have happened?

  • At step 2, Inkscape should warn that the file is open in another instance and give the user the option to switch to that instance or open the file again anyway
    • Warn when opening the same file in different sessions
  • At step 5, Inkscape should warn that the file has been modified by another process and give the user the option to reload the file from disk (and that local changes might be lost) or ignore external modification at this time
    • Warn and allow reloading of a file that has been modified by another process
  • At step 6, Inkscape should warn that the file has been modified elsewhere and saved since it had been opened in instance-2 and that the user needs to choose between saving the file anyway, saving under another name or cancel saving (and by implication, an application exit)
    • Warn when overwriting a file with a remembered last-modified timestamp that's older than the target file's current last-modified timestamp

Inkscape Version and OS:

  • Inkscape version 0.92.3
  • OS & version: Ubuntu Desktop 16.04.4

Other observations:

The expected behavior can be observed in gedit which handles these situations as listed. Even implementing the warning from expected-behavior-c should be enough to avoid most cases of loss of work.

Edited by René de Hesselle
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information