Permalink
Browse files

project: Do not try to save backup files for closed projects

  • Loading branch information...
1 parent a305f4e commit 737d0403456b6f9ffabaa964d697f4338b86f48b @nekohayo nekohayo committed Feb 12, 2012
Showing with 12 additions and 5 deletions.
  1. +12 −5 pitivi/project.py
View
@@ -249,8 +249,17 @@ def saveProject(self, project, uri=None, overwrite=False, formatter=None, backup
"""
if formatter is None:
formatter = ges.PitiviFormatter()
-
- if uri is None:
+ if backup:
+ if project.uri and self.current.uri is not None:
+ # Ignore whatever URI that is passed on to us. It's a trap.
+ uri = self._makeBackupURI(project.uri)
+ else:
+ # Do not try to save backup files for blank projects.
+ # It is possible that self.current.uri == None when the backup
+ # timer sent us an old instance of the (now closed) project.
+ return
+ elif uri is None:
+ # This allows calling saveProject without specifying the target URI
uri = project.uri
else:
# Ensure the URI we are given is properly encoded, or GIO will fail
@@ -361,13 +370,11 @@ def _projectChangedCb(self, project):
self.backup_lock += 5
def _saveBackupCb(self, project, uri):
- backup_uri = self._makeBackupURI(uri)
-
if self.backup_lock > 10:
self.backup_lock -= 5
return True
else:
- self.saveProject(project, backup_uri, overwrite=True, backup=True)
+ self.saveProject(project, overwrite=True, backup=True)
self.backup_lock = 0
return False

0 comments on commit 737d040

Please sign in to comment.