If a backup fails before close, ensure collection closed

Otherwise when user returns to profiles screen, they'll be unable to
open a different profile, as the collection is still open.

Encountered when opening the collection that triggered
https://github.com/ankitects/anki/issues/2123
This commit is contained in:
Damien Elmes 2022-10-29 11:08:58 +10:00
parent 0c340c4f74
commit e5c4ccf08c

View file

@ -624,12 +624,15 @@ class AnkiQt(QMainWindow):
try:
if not corrupt and not dev_mode and not self.restoring_backup:
# default 5 minute throttle
self.col.create_backup(
backup_folder=self.pm.backupFolder(),
force=False,
wait_for_completion=False,
)
try:
# default 5 minute throttle
self.col.create_backup(
backup_folder=self.pm.backupFolder(),
force=False,
wait_for_completion=False,
)
except:
print("backup on close failed")
self.col.close(downgrade=False)
except Exception as e:
print(e)