From e5c4ccf08c1bdbdeeca7464d27d56a5ed8cdfb91 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sat, 29 Oct 2022 11:08:58 +1000 Subject: [PATCH] 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 --- qt/aqt/main.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/qt/aqt/main.py b/qt/aqt/main.py index b02d010d3..8ed665e4f 100644 --- a/qt/aqt/main.py +++ b/qt/aqt/main.py @@ -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)