diff options
author | Timur Pocheptsov <timur.pocheptsov@qt.io> | 2017-04-05 15:35:38 +0200 |
---|---|---|
committer | Timur Pocheptsov <timur.pocheptsov@qt.io> | 2017-04-19 08:13:32 +0000 |
commit | 254f35ce98bebd8f4446fec66bb50f2126b61c28 (patch) | |
tree | d2520bb8efcaf98b97cabefe582243fceeabd001 /src/network/access | |
parent | 59d9ee0aa450c47fd266744d72da7ef61c027553 (diff) |
QNetworkReplyHttpImpl - check 'isOpen' twice
A signal emitted after the first 'isOpen' check on QNetworkReply can
trigger a slot that aborts/closes our reply. So before we can append
any data to reply's buffer, we have to re-check that we're still open.
Task-number: QTBUG-59909
Change-Id: I781d5a4fd5fc30d485af63f45cf36c254378af64
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/network/access')
-rw-r--r-- | src/network/access/qnetworkreplyhttpimpl.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp index bdb23ede1d..fec3b0a100 100644 --- a/src/network/access/qnetworkreplyhttpimpl.cpp +++ b/src/network/access/qnetworkreplyhttpimpl.cpp @@ -1883,6 +1883,12 @@ void QNetworkReplyHttpImplPrivate::_q_cacheLoadReadyRead() totalSize.isNull() ? Q_INT64_C(-1) : totalSize.toLongLong()); } } + + // A signal we've emitted might be handled by a slot that aborts, + // so we need to check for that and bail out if it's happened: + if (!q->isOpen()) + return; + // If there are still bytes available in the cacheLoadDevice then the user did not read // in response to the readyRead() signal. This means we have to load from the cacheLoadDevice // and buffer that stuff. This is needed to be able to properly emit finished() later. |