Ignore click events with invalid positions
Since Qt 5.11.2, various crash logs like this popped up after clicking a <select> element: Traceback (most recent call last): File ".../browser/mouse.py", line 239, in eventFilter return self._handlers[evtype](event) File ".../browser/mouse.py", line 121, in _handle_mouse_press self._mousepress_insertmode_cb) File ".../browser/webengine/webenginetab.py", line 624, in find_at_pos assert pos.x() >= 0 AssertionError This is probably caused by https://codereview.qt-project.org/#/c/193908/ in some way...
This commit is contained in:
parent
dd41bc2f7b
commit
a3ae950707
@ -96,6 +96,7 @@ Fixed
|
||||
- Crash when doing initial run on Wayland without XWayland
|
||||
- Crash when trying to load an empty session file.
|
||||
- `:hint` with an invalid `--mode=` value now shows a proper error.
|
||||
- Rare crash on Qt 5.11.2 when clicking on `<select>` elements.
|
||||
|
||||
Removed
|
||||
~~~~~~~
|
||||
|
@ -116,9 +116,13 @@ class MouseEventFilter(QObject):
|
||||
|
||||
self._ignore_wheel_event = True
|
||||
|
||||
pos = e.pos()
|
||||
if pos.x() < 0 or pos.y() < 0:
|
||||
log.mouse.warning("Ignoring invalid click at {}".format(pos))
|
||||
return False
|
||||
|
||||
if e.button() != Qt.NoButton:
|
||||
self._tab.elements.find_at_pos(e.pos(),
|
||||
self._mousepress_insertmode_cb)
|
||||
self._tab.elements.find_at_pos(pos, self._mousepress_insertmode_cb)
|
||||
|
||||
return False
|
||||
|
||||
|
@ -631,8 +631,8 @@ class WebEngineElements(browsertab.AbstractElements):
|
||||
self._tab.run_js_async(js_code, js_cb)
|
||||
|
||||
def find_at_pos(self, pos, callback):
|
||||
assert pos.x() >= 0
|
||||
assert pos.y() >= 0
|
||||
assert pos.x() >= 0, pos
|
||||
assert pos.y() >= 0, pos
|
||||
pos /= self._tab.zoom.factor()
|
||||
js_code = javascript.assemble('webelem', 'find_at_pos',
|
||||
pos.x(), pos.y())
|
||||
|
Loading…
Reference in New Issue
Block a user