mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Check for deletion in worker thread before emitting signal
This commit is contained in:
parent
68e16a0d12
commit
ec72e4f39d
@ -12,7 +12,7 @@ from hashlib import sha256
|
||||
from qt.core import (
|
||||
QApplication, QCursor, QDockWidget, QEvent, QMainWindow, QMenu, QMimeData,
|
||||
QModelIndex, QPixmap, Qt, QTimer, QToolBar, QUrl, QVBoxLayout, QWidget,
|
||||
pyqtSignal
|
||||
pyqtSignal, sip
|
||||
)
|
||||
from threading import Thread
|
||||
|
||||
@ -503,12 +503,15 @@ class EbookViewer(MainWindow):
|
||||
try:
|
||||
ans = prepare_book(pathtoebook, force=reload_book, prepare_notify=self.prepare_notify)
|
||||
except WorkerError as e:
|
||||
if not sip.isdeleted(self):
|
||||
self.book_prepared.emit(False, {'exception': e, 'tb': e.orig_tb, 'pathtoebook': pathtoebook})
|
||||
except Exception as e:
|
||||
import traceback
|
||||
if not sip.isdeleted(self):
|
||||
self.book_prepared.emit(False, {'exception': e, 'tb': traceback.format_exc(), 'pathtoebook': pathtoebook})
|
||||
else:
|
||||
performance_monitor('prepared emitted')
|
||||
if not sip.isdeleted(self):
|
||||
self.book_prepared.emit(True, {'base': ans, 'pathtoebook': pathtoebook, 'open_at': open_at, 'reloaded': reload_book})
|
||||
|
||||
def prepare_notify(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user