QtWebEngine: Fix crash when closing/reopening tabs

This commit is contained in:
Florian Bruhin 2016-08-01 17:25:55 +02:00
parent 5ec39b7540
commit 81d0d64731

View File

@ -211,6 +211,10 @@ class WebEngineScroller(browsertab.AbstractScroller):
"""Update the scroll position attributes when it changed."""
def update_scroll_pos(jsret):
"""Callback after getting scroll position via JS."""
if jsret is None:
# This can happen when the callback would get called after
# shutting down a tab
return
assert isinstance(jsret, dict), jsret
self._pos_perc = (jsret['perc']['x'], jsret['perc']['y'])
self._pos_px = QPoint(jsret['px']['x'], jsret['px']['y'])