summaryrefslogtreecommitdiffstats
path: root/src/core/url_request_context_getter_qt.cpp
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2017-05-29 19:04:44 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2017-06-18 15:36:46 +0000
commit55a5420173b6ab10611eb91386b54217b8218ba0 (patch)
treefc34dc57b81dc46a4e7396459fb0aa2e59b48d55 /src/core/url_request_context_getter_qt.cpp
parent53b632ee0b6dc92ffc4f94f88755d94f7533637a (diff)
Fix ASSERT in URLRequestContextGetterQt due to race condition
Setting httpCacheType followed by persistentCookiesPolicy may lead to io thread calling generateHttpCache just before generateCookieStore, which triggers assert in line 344. Recall generateHttpCache in case generateHttpCache was called before generateCookieStore. Task-number: QTBUG-61047 Change-Id: I1cfe5f18a884bd0d76fce4b30da0e22359cab2af Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/core/url_request_context_getter_qt.cpp')
-rw-r--r--src/core/url_request_context_getter_qt.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/core/url_request_context_getter_qt.cpp b/src/core/url_request_context_getter_qt.cpp
index 234109f1f..1f3d6fcbe 100644
--- a/src/core/url_request_context_getter_qt.cpp
+++ b/src/core/url_request_context_getter_qt.cpp
@@ -341,8 +341,7 @@ void URLRequestContextGetterQt::generateCookieStore()
cookieMonster->SetCookieableSchemes(cookieableSchemes);
m_cookieDelegate->setCookieMonster(cookieMonster);
- if (!m_updateAllStorage) {
- Q_ASSERT(m_updateHttpCache);
+ if (!m_updateAllStorage && m_updateHttpCache) {
// HttpCache needs to be regenerated when we generate a new channel id service
generateHttpCache();
}
@@ -470,6 +469,9 @@ void URLRequestContextGetterQt::generateHttpCache()
QMutexLocker lock(&m_mutex);
m_updateHttpCache = false;
+ if (m_updateCookieStore)
+ generateCookieStore();
+
net::HttpCache::DefaultBackend* main_backend = 0;
switch (m_httpCacheType) {
case BrowserContextAdapter::MemoryHttpCache: