diff options
author | Joerg Bornemann <joerg.bornemann@theqtcompany.com> | 2016-01-21 18:38:47 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-01-22 23:13:06 +0000 |
commit | 4fa6a7a7c7e15a560bd8503fb5c0dc2e6d1024c1 (patch) | |
tree | 79f920915adf1cf6996fb9e736e146750cd93d53 /src/core/url_request_custom_job.cpp | |
parent | d6e4d60e45a6fd7c67524b5ec79be75a922911bb (diff) |
Fix deadlock on QWebEngineUrlRequestJob::fail
URLRequestCustomJob::notifyFailure calls NotifyStartError(status), which
in turn will result in a call to URLRequestCustomJob::Kill.
We must release the lock of m_mutex before calling NotifyStartError,
otherwise m_mutex.lock() will wait forever in Kill.
Change-Id: I319e45049766c2192dfc46a91b352b92ec677bc6
Task-number: QTBUG-50160
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Diffstat (limited to 'src/core/url_request_custom_job.cpp')
-rw-r--r-- | src/core/url_request_custom_job.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/core/url_request_custom_job.cpp b/src/core/url_request_custom_job.cpp index 1b6f1c767..907f71c2e 100644 --- a/src/core/url_request_custom_job.cpp +++ b/src/core/url_request_custom_job.cpp @@ -222,13 +222,17 @@ void URLRequestCustomJob::fail(int error) void URLRequestCustomJob::notifyFailure() { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); - QMutexLocker lock(&m_mutex); + m_mutex.lock(); if (m_device) m_device->close(); - if (m_started) - NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, m_error)); + const URLRequestStatus status(URLRequestStatus::FAILED, m_error); + const bool started = m_started; + m_mutex.unlock(); + + if (started) + NotifyDone(status); else - NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, m_error)); + NotifyStartError(status); } void URLRequestCustomJob::startAsync() |