diff options
author | Michal Klocek <michal.klocek@qt.io> | 2018-08-02 11:56:29 +0200 |
---|---|---|
committer | Michal Klocek <michal.klocek@qt.io> | 2018-08-03 11:01:28 +0000 |
commit | 14a8ac1534bc4314cf6c89aceaaa382f42314dac (patch) | |
tree | a9eb363b39a3c9bcaa160aa89cc354deb543f610 | |
parent | 9a2448a292f6c1d3f134c39be2a01acea3cef982 (diff) |
Fix running webengine without default profile
If default profile is not needed do not create
by accident one in ~QWebEngineProfilePrivate.
Task-number: QTBUG-66068
Change-Id: Ib4131268686178560f3a89dce41e59eb57613e17
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r-- | src/core/content_browser_client_qt.cpp | 2 | ||||
-rw-r--r-- | src/core/profile_adapter.cpp | 5 | ||||
-rw-r--r-- | src/core/profile_adapter.h | 1 | ||||
-rw-r--r-- | src/core/web_engine_context.cpp | 7 | ||||
-rw-r--r-- | src/core/web_engine_context.h | 1 | ||||
-rw-r--r-- | src/webengine/api/qquickwebengineprofile.cpp | 2 | ||||
-rw-r--r-- | src/webenginewidgets/api/qwebengineprofile.cpp | 4 |
7 files changed, 17 insertions, 5 deletions
diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index 59d9a4a84..393b0aee1 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -768,7 +768,7 @@ scoped_refptr<net::URLRequestContextGetter> GetSystemRequestContextOnUIThread() { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); return scoped_refptr<net::URLRequestContextGetter>( - ProfileAdapter::defaultProfileAdapter()->profile()->GetRequestContext()); + ProfileAdapter::createDefaultProfileAdapter()->profile()->GetRequestContext()); } void ContentBrowserClientQt::GetGeolocationRequestContext( diff --git a/src/core/profile_adapter.cpp b/src/core/profile_adapter.cpp index 2ae568b64..da944979a 100644 --- a/src/core/profile_adapter.cpp +++ b/src/core/profile_adapter.cpp @@ -188,6 +188,11 @@ void ProfileAdapter::resumeDownload(quint32 downloadId) downloadManagerDelegate()->resumeDownload(downloadId); } +ProfileAdapter *ProfileAdapter::createDefaultProfileAdapter() +{ + return WebEngineContext::current()->createDefaultProfileAdapter(); +} + ProfileAdapter *ProfileAdapter::defaultProfileAdapter() { return WebEngineContext::current()->defaultProfileAdapter(); diff --git a/src/core/profile_adapter.h b/src/core/profile_adapter.h index 1e2a700d6..65843eda3 100644 --- a/src/core/profile_adapter.h +++ b/src/core/profile_adapter.h @@ -80,6 +80,7 @@ public: explicit ProfileAdapter(const QString &storagePrefix = QString()); virtual ~ProfileAdapter(); + static ProfileAdapter* createDefaultProfileAdapter(); static ProfileAdapter* defaultProfileAdapter(); static QObject* globalQObjectRoot(); diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index c691e0c6e..a7301e02d 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -265,7 +265,7 @@ WebEngineContext *WebEngineContext::current() return m_handle.get(); } -ProfileAdapter *WebEngineContext::defaultProfileAdapter() +ProfileAdapter *WebEngineContext::createDefaultProfileAdapter() { Q_ASSERT(!m_destroyed); if (!m_defaultProfileAdapter) @@ -273,6 +273,11 @@ ProfileAdapter *WebEngineContext::defaultProfileAdapter() return m_defaultProfileAdapter.get(); } +ProfileAdapter *WebEngineContext::defaultProfileAdapter() +{ + return m_defaultProfileAdapter.get(); +} + QObject *WebEngineContext::globalQObject() { return m_globalQObject.get(); diff --git a/src/core/web_engine_context.h b/src/core/web_engine_context.h index 678ad713d..e9e7c44a7 100644 --- a/src/core/web_engine_context.h +++ b/src/core/web_engine_context.h @@ -76,6 +76,7 @@ public: static WebEngineContext *current(); static void destroyContextPostRoutine(); + ProfileAdapter *createDefaultProfileAdapter(); ProfileAdapter *defaultProfileAdapter(); QObject *globalQObject(); diff --git a/src/webengine/api/qquickwebengineprofile.cpp b/src/webengine/api/qquickwebengineprofile.cpp index 48e5175ca..da84af8d0 100644 --- a/src/webengine/api/qquickwebengineprofile.cpp +++ b/src/webengine/api/qquickwebengineprofile.cpp @@ -689,7 +689,7 @@ void QQuickWebEngineProfile::setHttpAcceptLanguage(const QString &httpAcceptLang QQuickWebEngineProfile *QQuickWebEngineProfile::defaultProfile() { static QQuickWebEngineProfile *profile = new QQuickWebEngineProfile( - new QQuickWebEngineProfilePrivate(ProfileAdapter::defaultProfileAdapter()), + new QQuickWebEngineProfilePrivate(ProfileAdapter::createDefaultProfileAdapter()), ProfileAdapter::globalQObjectRoot()); return profile; } diff --git a/src/webenginewidgets/api/qwebengineprofile.cpp b/src/webenginewidgets/api/qwebengineprofile.cpp index 6969000a8..b66a1aa53 100644 --- a/src/webenginewidgets/api/qwebengineprofile.cpp +++ b/src/webenginewidgets/api/qwebengineprofile.cpp @@ -174,7 +174,7 @@ QWebEngineProfilePrivate::~QWebEngineProfilePrivate() m_ongoingDownloads.clear(); - if (q_ptr != QWebEngineProfile::defaultProfile()) + if (m_profileAdapter != QtWebEngineCore::ProfileAdapter::defaultProfileAdapter()) delete m_profileAdapter; delete m_settings; @@ -583,7 +583,7 @@ QWebEngineScriptCollection *QWebEngineProfile::scripts() const QWebEngineProfile *QWebEngineProfile::defaultProfile() { static QWebEngineProfile* profile = new QWebEngineProfile( - new QWebEngineProfilePrivate(ProfileAdapter::defaultProfileAdapter()), + new QWebEngineProfilePrivate(ProfileAdapter::createDefaultProfileAdapter()), ProfileAdapter::globalQObjectRoot()); return profile; } |