Workaround for bug in Qt causing a crash on unhandled exception in current_changed

This commit is contained in:
Kovid Goyal 2022-03-06 15:21:35 +05:30
parent 7e645a0e30
commit e467468783
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -578,7 +578,13 @@ class BooksModel(QAbstractTableModel): # {{{
def current_changed(self, current, previous, emit_signal=True):
if current.isValid():
idx = current.row()
try:
data = self.get_book_display_info(idx)
except Exception:
import traceback
error_dialog(None, _('Unhandled error'), _(
'Failed to read book data from calibre library. Click "Show details" for more information'), det_msg=traceback.format_exc(), show=True)
else:
if emit_signal:
self.new_bookdisplay_data.emit(data)
else:
@ -1601,7 +1607,13 @@ class DeviceBooksModel(BooksModel): # {{{
def current_changed(self, current, previous, emit_signal=True):
if current.isValid():
idx = current.row()
try:
data = self.get_book_display_info(idx)
except Exception:
import traceback
error_dialog(None, _('Unhandled error'), _(
'Failed to read book data from calibre library. Click "Show details" for more information'), det_msg=traceback.format_exc(), show=True)
else:
if emit_signal:
self.new_bookdisplay_data.emit(data)
else: