From b1979948b591cc865e2781bae1759e41b6d3a84b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 11 Jun 2011 15:19:53 -0600 Subject: [PATCH] ... --- src/calibre/gui2/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py index c217d90ddf..8461896d54 100644 --- a/src/calibre/gui2/__init__.py +++ b/src/calibre/gui2/__init__.py @@ -297,6 +297,7 @@ class FunctionDispatcher(QObject): dispatch_signal = pyqtSignal(object, object, object) def __init__(self, func, queued=True, parent=None): + global gui_thread QObject.__init__(self, parent) self.func = func typ = Qt.QueuedConnection @@ -305,6 +306,8 @@ class FunctionDispatcher(QObject): self.dispatch_signal.connect(self.dispatch, type=typ) self.q = Queue.Queue() self.lock = threading.Lock() + if gui_thread is None: + gui_thread = QThread.currentThread() def __call__(self, *args, **kwargs): if is_gui_thread():