From 18ad50679bbc01424917cef38c426e48b70e880e Mon Sep 17 00:00:00 2001 From: Charles Haley <> Date: Sat, 25 May 2013 11:44:22 +0200 Subject: [PATCH] Fix exception in quickview when libraries are changed when the window is open. --- src/calibre/gui2/dialogs/quickview.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/dialogs/quickview.py b/src/calibre/gui2/dialogs/quickview.py index 7b3719a49a..7ea75bc6ae 100644 --- a/src/calibre/gui2/dialogs/quickview.py +++ b/src/calibre/gui2/dialogs/quickview.py @@ -134,7 +134,16 @@ class Quickview(QDialog, Ui_Quickview): def book_was_changed(self, mi): if self.is_closed or self.current_column is None: return - self.refresh(self.view.model().index(self.db.row(mi.id), self.current_column)) + # There is an ordering problem when libraries are changed. The library + # view is changed, triggering a book_was_changed signal. Unfortunately + # this happens before the library_changed actions are run, meaning we + # still have the old database. To avoid the problem we just ignore the + # operation if we get an exception. The set_database will come + # eventually. + try: + self.refresh(self.view.model().index(self.db.row(mi.id), self.current_column)) + except: + pass # clicks on the items listWidget def item_selected(self, txt):