summaryrefslogtreecommitdiffstats
path: root/src/core/web_contents_adapter.cpp
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@digia.com>2014-08-14 17:45:07 +0200
committerJocelyn Turcotte <jocelyn.turcotte@digia.com>2014-08-15 14:10:26 +0200
commit2694ec6605891271ed99f69a03b3929178655963 (patch)
treee34426d92ffced7db70f7a3e4b8ba95ffa67c1e6 /src/core/web_contents_adapter.cpp
parent4fec7134b45c61422acb63043b70b3bb0456d690 (diff)
Fix a crash in WebEngineSettings when opening a new window
A new window means that the QWebEnginePage gets its WebContentsAdapter swapped and that the pointer in WebEngineSettings must be updated. Do the WebContentsAdapter-to-WebEngineSettings binding in WebContentsAdapter::initialize to cover both cases. This also refactors the way that QWebEngineSettings is created by removing the need to pass a QWebEngineSettingsPrivate instance to be adopted, and also move the global settings construction logic in the singleton accessor instead of relying on the fact that it uses a different contructor. Change-Id: I6f8a2ed1407a4b25f9898526db9432721c354ddf Reviewed-by: Andras Becsi <andras.becsi@digia.com> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
Diffstat (limited to 'src/core/web_contents_adapter.cpp')
-rw-r--r--src/core/web_contents_adapter.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp
index d2eb076d6..a4a8bbe23 100644
--- a/src/core/web_contents_adapter.cpp
+++ b/src/core/web_contents_adapter.cpp
@@ -357,6 +357,9 @@ void WebContentsAdapter::initialize(WebContentsAdapterClient *adapterClient)
if (!d->webContents)
d->webContents.reset(createBlankWebContents(adapterClient));
+ // This might replace any adapter that has been initialized with this WebEngineSettings.
+ adapterClient->webEngineSettings()->setWebContentsAdapter(this);
+
content::RendererPreferences* rendererPrefs = d->webContents->GetMutableRendererPrefs();
rendererPrefs->use_custom_colors = true;
// Qt returns a flash time (the whole cycle) in ms, chromium expects just the interval in seconds