From 72f403d52a0d610d0ec54db10dd2218c245aa6df Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 8 Apr 2026 13:39:27 +0000 Subject: [PATCH] Fix regression: EPUB annotations not saved due to immediate queue shutdown Agent-Logs-Url: https://github.com/kovidgoyal/calibre/sessions/171c5cc8-db33-468a-9656-d88b8b95ff40 Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com> --- src/calibre/gui2/viewer/annotations.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/calibre/gui2/viewer/annotations.py b/src/calibre/gui2/viewer/annotations.py index 3905638f94..e5d8e25d3e 100644 --- a/src/calibre/gui2/viewer/annotations.py +++ b/src/calibre/gui2/viewer/annotations.py @@ -67,19 +67,20 @@ class AnnotationsSaveWorker(Thread): self.queue = Queue() def shutdown(self): - self.queue.shutdown(True) + self.queue.shutdown(immediate=False) + self.join() def run(self): while True: try: x = self.queue.get() - while True: - try: - x = self.queue.get_nowait() - except Empty: - break except ShutDown: break + while True: + try: + x = self.queue.get_nowait() + except (Empty, ShutDown): + break annotations_list = x['annotations_list'] annotations_path_key = x['annotations_path_key'] bld = x['book_library_details']