Commit 7bd4109c authored by Allan Sandfeld Jensen's avatar Allan Sandfeld Jensen
Browse files

Merge branch '5.5' into 5.6

Change-Id: Ie1f05c97650ecb86a6fe2d69ad037790c315a83b
Showing with 18 additions and 0 deletions
......@@ -661,6 +661,18 @@ QAccessible::State QQuickWebEngineViewAccessible::state() const
}
#endif // QT_NO_ACCESSIBILITY
class WebContentsAdapterOwner : public QObject
{
public:
typedef QExplicitlySharedDataPointer<QtWebEngineCore::WebContentsAdapter> AdapterPtr;
WebContentsAdapterOwner(const AdapterPtr &ptr)
: adapter(ptr)
{}
private:
AdapterPtr adapter;
};
void QQuickWebEngineViewPrivate::adoptWebContents(WebContentsAdapter *webContents)
{
if (!webContents) {
......@@ -684,6 +696,8 @@ void QQuickWebEngineViewPrivate::adoptWebContents(WebContentsAdapter *webContent
// This throws away the WebContentsAdapter that has been used until now.
// All its states, particularly the loading URL, are replaced by the adopted WebContentsAdapter.
WebContentsAdapterOwner *adapterOwner = new WebContentsAdapterOwner(adapter);
adapterOwner->deleteLater();
adapter = webContents;
adapter->initialize(this);
......@@ -867,8 +881,12 @@ void QQuickWebEngineViewPrivate::setProfile(QQuickWebEngineProfile *profile)
if (adapter && adapter->browserContext() != browserContextAdapter()->browserContext()) {
// When the profile changes we need to create a new WebContentAdapter and reload the active URL.
QUrl activeUrl = adapter->activeUrl();
QQmlWebChannel *qmlWebChannel = qobject_cast<QQmlWebChannel *>(adapter->webChannel());
adapter = 0;
ensureContentsAdapter();
if (qmlWebChannel)
adapter->setWebChannel(qmlWebChannel);
if (!explicitUrl.isValid() && activeUrl.isValid())
adapter->load(activeUrl);
}
......
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