Skip to content

Commit

Permalink
Since PIDs between Flatpak ChimeraX's may not be unique, also embed p…
Browse files Browse the repository at this point in the history
…rocess

start time [#16631]
  • Loading branch information
e-pettersen committed Jan 16, 2025
1 parent f8d612e commit 6a1092a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/bundles/core/src/safesave.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
f.close(e)
"""
import os
import os, psutil


class SaveFile:
Expand Down Expand Up @@ -81,7 +81,10 @@ def __init__(self, filename, open=open, critical=False):
self.name = filename
self._critical = critical
# prevent conflicts between ChimeraX's running/starting at the same time
self._tmp_filename = filename + "." + str(os.getpid()) + ".tmp"
# Flatpak processes may have the same PID (typically 2), so also embed
# process start time
pid = os.getpid()
self._tmp_filename = filename + "." + str(pid) + "." + str(psutil.Process(pid).create_time()) + ".tmp"
self._f = open(self._tmp_filename)
assert(self._f.writable())

Expand Down

0 comments on commit 6a1092a

Please sign in to comment.