Skip to content

Commit

Permalink
Don't crash when other instances close the lock file
Browse files Browse the repository at this point in the history
Minor robustness improvement.

Fixes Sentry issue CURA-23B.
  • Loading branch information
Ghostkeeper committed May 19, 2021
1 parent 64f69a3 commit 10c766c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion UM/SaveFile.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2020 Ultimaker B.V.
# Copyright (c) 2021 Ultimaker B.V.
# Uranium is released under the terms of the LGPLv3 or higher.

import tempfile
Expand All @@ -14,6 +14,8 @@ def lockFile(file):
fcntl.flock(file, fcntl.LOCK_EX)
except OSError: # Some file systems don't support file locks.
pass
except ValueError: # Can fail on some operating systems due to other instances of the application closing the file to prepare for deletion.
pass # It's okay to ignore the lock then because they were about to delete the file anyway.

if hasattr(fcntl, 'F_FULLFSYNC'):
def fsync(fd):
Expand Down

0 comments on commit 10c766c

Please sign in to comment.