From ecb617366dd1c36e961297a0292de0a0d83e2fc6 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 9 May 2024 19:06:10 +0530 Subject: [PATCH] Run windows_repair using atexit Makes it even more likely the parent process quits before the restore process starts restoring. --- src/calibre/gui2/main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/main.py b/src/calibre/gui2/main.py index 5b3966c35ad3..7f99a9f0f8df 100644 --- a/src/calibre/gui2/main.py +++ b/src/calibre/gui2/main.py @@ -336,7 +336,8 @@ def initialize_db(self): # On some windows systems the existing db file gets locked # by something when running restore from the main process. # So run the restore in a separate process. - windows_repair(self.library_path) + import atexit + atexit.register(windows_repair, self.library_path) self.app.quit() return if repair_library(self.library_path):