From 0bb80329e8c9ef3909f140fe401e333df716f087 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sat, 2 May 2020 12:42:52 +1000 Subject: [PATCH] ensure collection doesn't get stuck open if loading fails --- qt/aqt/main.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/qt/aqt/main.py b/qt/aqt/main.py index c8fbd594d..9c5958af7 100644 --- a/qt/aqt/main.py +++ b/qt/aqt/main.py @@ -482,13 +482,11 @@ close the profile or restart Anki.""" tr(TR.ERRORS_UNABLE_OPEN_COLLECTION) + "\n" + traceback.format_exc() ) # clean up open collection if possible - if self.col: - try: - self.col.close(save=False, downgrade=False) - except: - pass - self.col = None - + try: + self.backend.close_collection(False) + except Exception as e: + print("unable to close collection:", e) + self.col = None # return to profile manager self.hide() self.showProfileManager()