summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2021-02-18 17:30:48 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2021-02-23 05:07:09 +0000
commit000f301289f9c514e155fb108f609d49769be03f (patch)
tree190cc417f8a477bd072008299c6252f450fb7ab0
parenta00fb61776425ed0f32d4d4052ffb1567f62e6d7 (diff)
Do not flush messages form profile destructor
Flush ui messages in profile adapter instead, otherwise we will refer to already destroyed adapter (which we track by qpointer), if some ui messages are being processed. Note profile adapter owns profile so it should be fine to notify about coming browser context destruction. Pick-to: 5.15 Change-Id: Idaa29a459c984ca73d1f5f9ca61b96c9b4017259 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r--src/core/profile_adapter.cpp3
-rw-r--r--src/core/profile_qt.cpp2
2 files changed, 3 insertions, 2 deletions
diff --git a/src/core/profile_adapter.cpp b/src/core/profile_adapter.cpp
index 81c4f9809..dff98717d 100644
--- a/src/core/profile_adapter.cpp
+++ b/src/core/profile_adapter.cpp
@@ -121,6 +121,7 @@ ProfileAdapter::ProfileAdapter(const QString &storageName):
ProfileAdapter::~ProfileAdapter()
{
+ content::BrowserContext::NotifyWillBeDestroyed(m_profile.data());
while (!m_webContentsAdapterClients.isEmpty()) {
m_webContentsAdapterClients.first()->releaseProfile();
}
@@ -131,7 +132,9 @@ ProfileAdapter::~ProfileAdapter()
}
#if QT_CONFIG(ssl)
delete m_clientCertificateStore;
+ m_clientCertificateStore = nullptr;
#endif
+ WebEngineContext::flushMessages();
}
void ProfileAdapter::setStorageName(const QString &storageName)
diff --git a/src/core/profile_qt.cpp b/src/core/profile_qt.cpp
index dac6658e2..36303605f 100644
--- a/src/core/profile_qt.cpp
+++ b/src/core/profile_qt.cpp
@@ -111,8 +111,6 @@ ProfileQt::~ProfileQt()
{
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
m_prefServiceAdapter.commit();
- content::BrowserContext::NotifyWillBeDestroyed(this);
- WebEngineContext::flushMessages();
BrowserContextDependencyManager::GetInstance()->DestroyBrowserContextServices(this);
ShutdownStoragePartitions();
m_profileIOData->shutdownOnUIThread();