From fe61a72b8339604d939ff2d148ce703d27168592 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 16 Feb 2020 18:20:06 +0530 Subject: [PATCH] Avoid runtime errors during shutdown of CLI plugins that use check_css --- src/calibre/ebooks/oeb/polish/check/css.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/oeb/polish/check/css.py b/src/calibre/ebooks/oeb/polish/check/css.py index f7d7ea3b68..efce567d32 100644 --- a/src/calibre/ebooks/oeb/polish/check/css.py +++ b/src/calibre/ebooks/oeb/polish/check/css.py @@ -222,7 +222,12 @@ class Pool(object): self.working = False def shutdown(self): - tuple(map(sip.delete, self.workers)) + + def safe_delete(x): + if not sip.isdeleted(x): + sip.delete(x) + + tuple(map(safe_delete, self.workers)) self.workers = []