E-book viewer: Clear history when reloading the book, to avoid errors, since the locations pointed to by the history may no longer be valid anyway

This commit is contained in:
Kovid Goyal 2014-10-30 09:27:48 +05:30
parent 3e2a75327a
commit bcf619955b
2 changed files with 5 additions and 3 deletions

View File

@ -955,6 +955,7 @@ class EbookViewer(MainWindow):
reopen_at = self.current_page_bookmark
except Exception:
reopen_at = None
self.history.clear()
self.load_ebook(self.iterator.pathtoebook, reopen_at=reopen_at)
return

View File

@ -106,14 +106,15 @@ class History(list): # {{{
self.action_back = action_back
self.action_forward = action_forward
super(History, self).__init__(self)
self.clear()
def clear(self):
del self[:]
self.insert_pos = 0
self.back_pos = None
self.forward_pos = None
self.set_actions()
def clear(self):
del self[:]
def set_actions(self):
if self.action_back is not None:
self.action_back.setDisabled(self.back_pos is None)