summaryrefslogtreecommitdiff
path: root/qutebrowser/browser/hints.py
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2019-05-11 18:22:55 +0200
committerFlorian Bruhin <me@the-compiler.org>2019-05-11 18:22:55 +0200
commit68f91ab149aa95c1a5da2c7f679ede564ca0a752 (patch)
tree1f92b5cb1cb623a330157f382a2f3c092e6251e9 /qutebrowser/browser/hints.py
parent0b3ba03398e6adb7650d4f158b4c9cd7bca82793 (diff)
parent18d797a1718c62db3621768f101196c1323be3de (diff)
downloadqutebrowser-68f91ab149aa95c1a5da2c7f679ede564ca0a752.tar.gz
qutebrowser-68f91ab149aa95c1a5da2c7f679ede564ca0a752.zip
Merge remote-tracking branch 'origin/pr/4764'
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 375f66cfa..6b71e6dd6 100644
--- a/qutebrowser/browser/hints.py
+++ b/qutebrowser/browser/hints.py
@@ -597,6 +597,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)))