summaryrefslogtreecommitdiff
path: root/src/network/access
diff options
context:
space:
mode:
authorShane Kearns <ext-shane.2.kearns@nokia.com>2012-06-28 14:52:45 +0100
committerQt by Nokia <qt-info@nokia.com>2012-07-04 14:26:44 +0200
commit365f262d0efd17f7a7f187ae701d5052f0cb960e (patch)
tree4053058dfb90b0a6748bd4abeddd13bdad167a39 /src/network/access
parentd25fc4c63fa4512aa1cfc5ce3877e4d8632b3fec (diff)
downloadqt4-tools-365f262d0efd17f7a7f187ae701d5052f0cb960e.tar.gz
Add null httpReply checks to QHttpThreadDelegate
If a request is aborted while under load, the abort signal can be queued in front of a signal emitted from the httpReply. The abort slot is deleting the httpReply and setting it to null. So when the queued slot is processed the httpReply is null and caused an MMU fault. Removed qWarning from existing null checks, as these are expected if abort is called with precise timing so that it races with the reply finishing on the socket. Task-number: QTBUG-26245 Change-Id: I0a7e0223fda1bc01d117fe8a993c7f6e43fd72ff Reviewed-by: Jonas Gastal <jgastal@profusion.mobi> Reviewed-by: Richard J. Moore <rich@kde.org> (cherry picked from commit 41064f851591d9437baeda502b6e2504fee8f213)
Diffstat (limited to 'src/network/access')
-rw-r--r--src/network/access/qhttpthreaddelegate.cpp31
1 files changed, 25 insertions, 6 deletions
diff --git a/src/network/access/qhttpthreaddelegate.cpp b/src/network/access/qhttpthreaddelegate.cpp
index adfe14e993..b461eea378 100644
--- a/src/network/access/qhttpthreaddelegate.cpp
+++ b/src/network/access/qhttpthreaddelegate.cpp
@@ -410,10 +410,9 @@ void QHttpThreadDelegate::readyReadSlot()
void QHttpThreadDelegate::finishedSlot()
{
- if (!httpReply) {
- qWarning("QHttpThreadDelegate::finishedSlot: HTTP reply had already been deleted, internal problem. Please report.");
+ if (!httpReply)
return;
- }
+
#ifdef QHTTPTHREADDELEGATE_DEBUG
qDebug() << "QHttpThreadDelegate::finishedSlot() thread=" << QThread::currentThreadId() << "result=" << httpReply->statusCode();
#endif
@@ -446,6 +445,9 @@ void QHttpThreadDelegate::finishedSlot()
void QHttpThreadDelegate::synchronousFinishedSlot()
{
+ if (!httpReply)
+ return;
+
#ifdef QHTTPTHREADDELEGATE_DEBUG
qDebug() << "QHttpThreadDelegate::synchronousFinishedSlot() thread=" << QThread::currentThreadId() << "result=" << httpReply->statusCode();
#endif
@@ -466,10 +468,9 @@ void QHttpThreadDelegate::synchronousFinishedSlot()
void QHttpThreadDelegate::finishedWithErrorSlot(QNetworkReply::NetworkError errorCode, const QString &detail)
{
- if (!httpReply) {
- qWarning("QHttpThreadDelegate::finishedWithErrorSlot: HTTP reply had already been deleted, internal problem. Please report.");
+ if (!httpReply)
return;
- }
+
#ifdef QHTTPTHREADDELEGATE_DEBUG
qDebug() << "QHttpThreadDelegate::finishedWithErrorSlot() thread=" << QThread::currentThreadId() << "error=" << errorCode << detail;
#endif
@@ -490,6 +491,9 @@ void QHttpThreadDelegate::finishedWithErrorSlot(QNetworkReply::NetworkError erro
void QHttpThreadDelegate::synchronousFinishedWithErrorSlot(QNetworkReply::NetworkError errorCode, const QString &detail)
{
+ if (!httpReply)
+ return;
+
#ifdef QHTTPTHREADDELEGATE_DEBUG
qDebug() << "QHttpThreadDelegate::synchronousFinishedWithErrorSlot() thread=" << QThread::currentThreadId() << "error=" << errorCode << detail;
#endif
@@ -508,6 +512,9 @@ static void downloadBufferDeleter(char *ptr)
void QHttpThreadDelegate::headerChangedSlot()
{
+ if (!httpReply)
+ return;
+
#ifdef QHTTPTHREADDELEGATE_DEBUG
qDebug() << "QHttpThreadDelegate::headerChangedSlot() thread=" << QThread::currentThreadId();
#endif
@@ -544,6 +551,9 @@ void QHttpThreadDelegate::headerChangedSlot()
void QHttpThreadDelegate::synchronousHeaderChangedSlot()
{
+ if (!httpReply)
+ return;
+
#ifdef QHTTPTHREADDELEGATE_DEBUG
qDebug() << "QHttpThreadDelegate::synchronousHeaderChangedSlot() thread=" << QThread::currentThreadId();
#endif
@@ -576,6 +586,9 @@ void QHttpThreadDelegate::cacheCredentialsSlot(const QHttpNetworkRequest &reques
#ifndef QT_NO_OPENSSL
void QHttpThreadDelegate::sslErrorsSlot(const QList<QSslError> &errors)
{
+ if (!httpReply)
+ return;
+
emit sslConfigurationChanged(httpReply->sslConfiguration());
bool ignoreAll = false;
@@ -590,6 +603,9 @@ void QHttpThreadDelegate::sslErrorsSlot(const QList<QSslError> &errors)
void QHttpThreadDelegate::synchronousAuthenticationRequiredSlot(const QHttpNetworkRequest &request, QAuthenticator *a)
{
+ if (!httpReply)
+ return;
+
Q_UNUSED(request);
#ifdef QHTTPTHREADDELEGATE_DEBUG
qDebug() << "QHttpThreadDelegate::synchronousAuthenticationRequiredSlot() thread=" << QThread::currentThreadId();
@@ -610,6 +626,9 @@ void QHttpThreadDelegate::synchronousAuthenticationRequiredSlot(const QHttpNetwo
#ifndef QT_NO_NETWORKPROXY
void QHttpThreadDelegate::synchronousProxyAuthenticationRequiredSlot(const QNetworkProxy &p, QAuthenticator *a)
{
+ if (!httpReply)
+ return;
+
#ifdef QHTTPTHREADDELEGATE_DEBUG
qDebug() << "QHttpThreadDelegate::synchronousProxyAuthenticationRequiredSlot() thread=" << QThread::currentThreadId();
#endif