Commit ff1eb61a authored by Peter Varga's avatar Peter Varga
Browse files

Fix crash on accessing WebEngineView properties too early


WebContentsAdapter is not created together with the QQuickWebEngineView.
Thus querying a view property can lead to a crash if it uses the adapter.
This fix adds the missing guards for contentSize and scrollPosition
as it is done for similar WebEngineView properties.

Task-number: QTBUG-65942
Change-Id: I9c2668a059b08325629f5730608280ba7f3669cf
Reviewed-by: default avatarAlexandru Croitor <alexandru.croitor@qt.io>
Showing with 4 additions and 0 deletions
......@@ -1719,12 +1719,16 @@ void QQuickWebEngineView::triggerWebAction(WebAction action)
QSizeF QQuickWebEngineView::contentsSize() const
{
Q_D(const QQuickWebEngineView);
if (!d->adapter)
return QSizeF();
return d->adapter->lastContentsSize();
}
QPointF QQuickWebEngineView::scrollPosition() const
{
Q_D(const QQuickWebEngineView);
if (!d->adapter)
return QPointF();
return d->adapter->lastScrollOffset();
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment