From bc9a8dd63f98b7ffab1493b16b96c3db730f4d0c Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 23 Apr 2018 16:52:53 +0200 Subject: [PATCH] Handle focusProxy being None This fixes running with Qt 5.11 See https://codereview.qt-project.org/#/c/221408/10 and #3661: https://github.com/qutebrowser/qutebrowser/issues/3661#issuecomment-375969315 --- qutebrowser/browser/webengine/webenginetab.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/qutebrowser/browser/webengine/webenginetab.py b/qutebrowser/browser/webengine/webenginetab.py index 6fd2c20b2..145bc9c44 100644 --- a/qutebrowser/browser/webengine/webenginetab.py +++ b/qutebrowser/browser/webengine/webenginetab.py @@ -755,7 +755,9 @@ class WebEngineTab(browsertab.AbstractTab): scripts.insert(new_script) def _install_event_filter(self): - self._widget.focusProxy().installEventFilter(self._mouse_event_filter) + fp = self._widget.focusProxy() + if fp is not None: + fp.installEventFilter(self._mouse_event_filter) self._child_event_filter = mouse.ChildEventFilter( eventfilter=self._mouse_event_filter, widget=self._widget, parent=self) @@ -1102,4 +1104,6 @@ class WebEngineTab(browsertab.AbstractTab): self.predicted_navigation.connect(self._on_predicted_navigation) def event_target(self): - return self._widget.focusProxy() + fp = self._widget.focusProxy() + assert fp is not None + return fp