Blob Blame History Raw
From ca70f1f214e54aa6f9a173fb2c28be6f13497341 Mon Sep 17 00:00:00 2001
From: Kovid Goyal <kovid@kovidgoyal.net>
Date: Thu, 8 Aug 2019 22:29:03 +0530
Subject: [PATCH 46/71] Fix #1839494 [Application crashes on changing
 icons](https://bugs.launchpad.net/calibre/+bug/1839494)

---
 src/calibre/gui2/icon_theme.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/calibre/gui2/icon_theme.py b/src/calibre/gui2/icon_theme.py
index d898561244..c987cb8c81 100644
--- a/src/calibre/gui2/icon_theme.py
+++ b/src/calibre/gui2/icon_theme.py
@@ -18,6 +18,10 @@ from PyQt5.Qt import (
     QGridLayout, QStyledItemDelegate, QApplication, QStaticText,
     QStyle, QPen, QProgressDialog
 )
+try:
+    from PyQt5 import sip
+except ImportError:
+    import sip
 
 from calibre import walk, fit_image, human_readable, detect_ncpus as cpu_count
 from calibre.constants import cache_dir, config_dir
@@ -689,7 +693,8 @@ class ChooseTheme(Dialog):
             import traceback
             self.themes = traceback.format_exc()
         t.join()
-        self.themes_downloaded.emit()
+        if not sip.isdeleted(self):
+            self.themes_downloaded.emit()
 
     def show_themes(self):
         self.end_spinner()