Fix crash when closing tab then doing tab-focus-last.
This commit is contained in:
parent
8ce779261f
commit
cf8a8ad3b4
@ -572,6 +572,8 @@ class CommandDispatcher:
|
|||||||
@cmdutils.register(instance='mainwindow.tabs.cmd')
|
@cmdutils.register(instance='mainwindow.tabs.cmd')
|
||||||
def tab_focus_last(self):
|
def tab_focus_last(self):
|
||||||
"""Select the tab which was last focused."""
|
"""Select the tab which was last focused."""
|
||||||
|
if self._tabs.last_focused is None:
|
||||||
|
raise CommandError("No last focused tab!")
|
||||||
idx = self._tabs.indexOf(self._tabs.last_focused)
|
idx = self._tabs.indexOf(self._tabs.last_focused)
|
||||||
if idx == -1:
|
if idx == -1:
|
||||||
raise CommandError("Last focused tab vanished!")
|
raise CommandError("Last focused tab vanished!")
|
||||||
|
@ -268,6 +268,10 @@ class TabbedBrowser(TabWidget):
|
|||||||
tab = self.widget(idx)
|
tab = self.widget(idx)
|
||||||
if tab is None:
|
if tab is None:
|
||||||
raise ValueError("invalid index {}!".format(idx))
|
raise ValueError("invalid index {}!".format(idx))
|
||||||
|
if tab is self.now_focused:
|
||||||
|
self.now_focused = None
|
||||||
|
if tab is self.last_focused:
|
||||||
|
self.last_focused = None
|
||||||
last_close = config.get('tabbar', 'last-close')
|
last_close = config.get('tabbar', 'last-close')
|
||||||
if self.count() > 1:
|
if self.count() > 1:
|
||||||
url = tab.url()
|
url = tab.url()
|
||||||
|
Loading…
Reference in New Issue
Block a user