Fix #2449 (Crashing on mac os X 10.5.7 when cancel metadata search)

This commit is contained in:
Kovid Goyal 2009-05-16 18:26:32 -07:00
parent 40bae0cf4a
commit 2bad2c5162
2 changed files with 17 additions and 15 deletions

View File

@ -187,6 +187,8 @@ class FetchMetadata(QDialog, Ui_FetchMetadata):
def terminate(self):
if hasattr(self, 'fetcher') and self.fetcher.isRunning():
self.fetcher.terminate()
if hasattr(self, '_hangcheck') and self._hangcheck.isActive():
self._hangcheck.stop()
def __enter__(self, *args):

View File

@ -419,9 +419,9 @@ class MetadataSingleDialog(ResizableDialog, Ui_MetadataSingleDialog):
publisher = qstring_to_unicode(self.publisher.currentText())
if isbn or title or author or publisher:
d = FetchMetadata(self, isbn, title, author, publisher, self.timeout)
self._fetch_metadata_scope = d
with d:
d.exec_()
if d.result() == QDialog.Accepted:
if d.exec_() == QDialog.Accepted:
book = d.selected_book()
if book:
self.title.setText(book.title)