summaryrefslogtreecommitdiff
path: root/qutebrowser/browser/hints.py
diff options
context:
space:
mode:
authoruser202729 <25191436+user202729@users.noreply.github.com>2019-05-07 23:51:38 +0700
committeruser202729 <25191436+user202729@users.noreply.github.com>2019-05-08 07:16:39 +0700
commit489cc98a9ed9cf73e3562f7a06e220a54658f7ee (patch)
tree8a141ad55b10711165734ddcb55b214b9144cd02 /qutebrowser/browser/hints.py
parent13c8e19632d7be4597409fa00158342bc801f070 (diff)
downloadqutebrowser-489cc98a9ed9cf73e3562f7a06e220a54658f7ee.tar.gz
qutebrowser-489cc98a9ed9cf73e3562f7a06e220a54658f7ee.zip
Check if the tab is current in HintManager._start_cb
Fixes #3892.
Diffstat (limited to 'qutebrowser/browser/hints.py')
-rw-r--r--qutebrowser/browser/hints.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/qutebrowser/browser/hints.py b/qutebrowser/browser/hints.py
index 9278d4f95..3133dc413 100644
--- a/qutebrowser/browser/hints.py
+++ b/qutebrowser/browser/hints.py
@@ -591,6 +591,18 @@ class HintManager(QObject):
message.error("No elements found.")
return
+ # Because _start_cb is called asynchronously, it's possible that the
+ # user switched to another tab or closed the tab/window. In that case
+ # we should not start hinting.
+ tabbed_browser = objreg.get('tabbed-browser', default=None,
+ scope='window', window=self._win_id)
+ tab = tabbed_browser.widget.currentWidget()
+ if tab.tab_id != self._tab_id:
+ log.hints.debug(
+ "Current tab changed ({} -> {}) before _start_cb is run."
+ .format(self._tab_id, tab.tab_id))
+ return
+
strings = self._hint_strings(elems)
log.hints.debug("hints: {}".format(', '.join(strings)))