make sure we swallow the exception when closing

otherwise the main window sticks around with no collection
This commit is contained in:
Damien Elmes 2017-08-16 21:06:50 +10:00
parent 4467b7c991
commit 194c02ed16

View file

@ -338,15 +338,18 @@ Debug info:
corrupt = self.col.db.scalar("pragma integrity_check") != "ok" corrupt = self.col.db.scalar("pragma integrity_check") != "ok"
except: except:
corrupt = True corrupt = True
try:
self.col.close()
except:
corrupt = True
finally:
self.col = None
if corrupt: if corrupt:
showWarning(_("Your collection file appears to be corrupt. \ showWarning(_("Your collection file appears to be corrupt. \
This can happen when the file is copied or moved while Anki is open, or \ This can happen when the file is copied or moved while Anki is open, or \
when the collection is stored on a network or cloud drive. Please see \ when the collection is stored on a network or cloud drive. If problems \
the manual for information on how to restore from an automatic backup.")) persist after restarting your computer, please open an automatic backup \
try: from the profile screen."))
self.col.close()
finally:
self.col = None
if not corrupt and not self.restoringBackup: if not corrupt and not self.restoringBackup:
self.backup() self.backup()