diff options
author | Michal Klocek <michal.klocek@qt.io> | 2022-10-13 10:36:11 +0200 |
---|---|---|
committer | Michal Klocek <michal.klocek@qt.io> | 2022-10-17 09:50:45 +0000 |
commit | 7c5546a78b1cbcf6d811648c003deb219ab6d070 (patch) | |
tree | af0ce68a8152eb75acd1faec49151d3d9c0de1ac /src/webenginewidgets | |
parent | 1837eeb96693116ba4ec8542035003cac67421bc (diff) | |
download | qtwebengine-7c5546a78b1cbcf6d811648c003deb219ab6d070.tar.gz |
Fix bogus layouting of qwebengineview
We did not really change pointers for doing a widget
and a item delegate binding. This at some point was
blowing up as we did not remove the old widget before
inserting the new widget into the internal webengineview
layout. The issue could get unnoticed for a while as the
old widget got eventually removed on a destruction.
However, at times when on the qlayout activation call
the old widget was considered, resize event
was triggered which was setting viewport to false value
(minimum size to hold two webcontents).
Make sure we remove widget before adding the new widget.
This fixes the widget and the item bind, however this
logic should be rewritten for dev branch as is get more
and more complex.
Fixes: QTBUG-107529
Pick-to: 6.4
Change-Id: I31d180b54f52e38b3c335cfa2bf3afa61e449677
Reviewed-by: Martin Negyokru <negyokru@inf.u-szeged.hu>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/webenginewidgets')
-rw-r--r-- | src/webenginewidgets/api/qwebengineview.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/webenginewidgets/api/qwebengineview.cpp b/src/webenginewidgets/api/qwebengineview.cpp index af7d27dab..f75945942 100644 --- a/src/webenginewidgets/api/qwebengineview.cpp +++ b/src/webenginewidgets/api/qwebengineview.cpp @@ -699,11 +699,19 @@ void QWebEngineViewPrivate::bindPageAndWidget(QWebEnginePagePrivate *pagePrivate // Change pointers first. - if (oldPagePrivate && oldPagePrivate != pagePrivate) - oldPagePrivate->delegateItem = nullptr; + if (widget && oldPagePrivate != pagePrivate) { + if (oldPagePrivate) + oldPagePrivate->delegateItem = nullptr; + if (widget->m_contentItem) + widget->m_contentItem->m_adapterClient = pagePrivate; + } - if (pagePrivate && oldWidget != widget) - pagePrivate->delegateItem = widget->m_contentItem; + if (pagePrivate && oldWidget != widget) { + if (oldWidget && oldWidget->m_contentItem) + oldWidget->m_contentItem->m_adapterClient = nullptr; + if (widget) + pagePrivate->delegateItem = widget->m_contentItem; + } // Then notify. |