mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Workaround for bug in Qt causing a crash on unhandled exception in current_changed
This commit is contained in:
parent
7e645a0e30
commit
e467468783
@ -578,7 +578,13 @@ class BooksModel(QAbstractTableModel): # {{{
|
|||||||
def current_changed(self, current, previous, emit_signal=True):
|
def current_changed(self, current, previous, emit_signal=True):
|
||||||
if current.isValid():
|
if current.isValid():
|
||||||
idx = current.row()
|
idx = current.row()
|
||||||
|
try:
|
||||||
data = self.get_book_display_info(idx)
|
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:
|
if emit_signal:
|
||||||
self.new_bookdisplay_data.emit(data)
|
self.new_bookdisplay_data.emit(data)
|
||||||
else:
|
else:
|
||||||
@ -1601,7 +1607,13 @@ class DeviceBooksModel(BooksModel): # {{{
|
|||||||
def current_changed(self, current, previous, emit_signal=True):
|
def current_changed(self, current, previous, emit_signal=True):
|
||||||
if current.isValid():
|
if current.isValid():
|
||||||
idx = current.row()
|
idx = current.row()
|
||||||
|
try:
|
||||||
data = self.get_book_display_info(idx)
|
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:
|
if emit_signal:
|
||||||
self.new_bookdisplay_data.emit(data)
|
self.new_bookdisplay_data.emit(data)
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user