diff options
author | Water-Team <water@pad.test.qt.nokia.com> | 2011-10-07 23:00:14 (GMT) |
---|---|---|
committer | Water-Team <water@pad.test.qt.nokia.com> | 2011-10-07 23:00:14 (GMT) |
commit | 34ad8bd00efbc4f76066826f068b3d7bff0152c0 (patch) | |
tree | da24f8987e5e26d85024fe2b5e7342625bd04e78 /src/network | |
parent | 1e8479b2aa781e6ce3fadf01294023fbc6ddbc22 (diff) | |
parent | 95e5e8ff45d2aa8acda595186136b54f695bb9cb (diff) | |
download | Qt-34ad8bd00efbc4f76066826f068b3d7bff0152c0.zip Qt-34ad8bd00efbc4f76066826f068b3d7bff0152c0.tar.gz Qt-34ad8bd00efbc4f76066826f068b3d7bff0152c0.tar.bz2 |
Merge branch '4.8-upstream' into master-water
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/access/qhttpnetworkreply.cpp | 2 | ||||
-rw-r--r-- | src/network/access/qnetworkreplyimpl.cpp | 23 | ||||
-rw-r--r-- | src/network/access/qnetworkreplyimpl_p.h | 2 | ||||
-rw-r--r-- | src/network/kernel/qhostinfo_win.cpp | 5 |
4 files changed, 25 insertions, 7 deletions
diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp index 1a02200..6173b39 100644 --- a/src/network/access/qhttpnetworkreply.cpp +++ b/src/network/access/qhttpnetworkreply.cpp @@ -891,7 +891,7 @@ bool QHttpNetworkReplyPrivate::expectContent() || statusCode == 204 || statusCode == 304) return false; if (request.operation() == QHttpNetworkRequest::Head) - return !shouldEmitSignals(); + return false; // no body expected for HEAD request qint64 expectedContentLength = contentLength(); if (expectedContentLength == 0) return false; diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 0b568d4..6f2daec 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -471,6 +471,7 @@ bool QNetworkReplyImplPrivate::isCachingEnabled() const void QNetworkReplyImplPrivate::setCachingEnabled(bool enable) { + Q_Q(QNetworkReplyImpl); if (!enable && !cacheEnabled) return; // nothing to do if (enable && cacheEnabled) @@ -493,15 +494,27 @@ void QNetworkReplyImplPrivate::setCachingEnabled(bool enable) networkCache()->remove(url); cacheSaveDevice = 0; cacheEnabled = false; + QObject::disconnect(networkCache(), SIGNAL(destroyed()), q, SLOT(_q_cacheDestroyed())); } } +void QNetworkReplyImplPrivate::_q_cacheDestroyed() +{ + //destruction of cache invalidates cacheSaveDevice + cacheSaveDevice = 0; + cacheEnabled = false; +} + void QNetworkReplyImplPrivate::completeCacheSave() { - if (cacheEnabled && errorCode != QNetworkReplyImpl::NoError) { - networkCache()->remove(url); - } else if (cacheEnabled && cacheSaveDevice) { - networkCache()->insert(cacheSaveDevice); + Q_Q(QNetworkReplyImpl); + if (cacheEnabled) { + if (errorCode != QNetworkReplyImpl::NoError) { + networkCache()->remove(url); + } else if (cacheSaveDevice) { + networkCache()->insert(cacheSaveDevice); + } + QObject::disconnect(networkCache(), SIGNAL(destroyed()), q, SLOT(_q_cacheDestroyed())); } cacheSaveDevice = 0; cacheEnabled = false; @@ -561,6 +574,8 @@ void QNetworkReplyImplPrivate::initCacheSaveDevice() networkCache()->remove(url); cacheSaveDevice = 0; cacheEnabled = false; + } else { + q->connect(networkCache(), SIGNAL(destroyed()), SLOT(_q_cacheDestroyed())); } } diff --git a/src/network/access/qnetworkreplyimpl_p.h b/src/network/access/qnetworkreplyimpl_p.h index 089c87e..286d8ea 100644 --- a/src/network/access/qnetworkreplyimpl_p.h +++ b/src/network/access/qnetworkreplyimpl_p.h @@ -104,6 +104,7 @@ public: Q_PRIVATE_SLOT(d_func(), void _q_networkSessionConnected()) Q_PRIVATE_SLOT(d_func(), void _q_networkSessionFailed()) #endif + Q_PRIVATE_SLOT(d_func(), void _q_cacheDestroyed()) }; class QNetworkReplyImplPrivate: public QNetworkReplyPrivate @@ -140,6 +141,7 @@ public: void _q_networkSessionConnected(); void _q_networkSessionFailed(); #endif + void _q_cacheDestroyed(); void setup(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice *outgoingData); diff --git a/src/network/kernel/qhostinfo_win.cpp b/src/network/kernel/qhostinfo_win.cpp index 1cbf350..58a5bee 100644 --- a/src/network/kernel/qhostinfo_win.cpp +++ b/src/network/kernel/qhostinfo_win.cpp @@ -102,7 +102,7 @@ static void resolveLibrary() #if defined(Q_OS_WINCE) #include <qmutex.h> -QMutex qPrivCEMutex; +Q_GLOBAL_STATIC(QMutex, qPrivCEMutex) #endif QHostInfo QHostInfoAgent::fromName(const QString &hostName) @@ -110,8 +110,9 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName) resolveLibrary(); #if defined(Q_OS_WINCE) - QMutexLocker locker(&qPrivCEMutex); + QMutexLocker locker(qPrivCEMutex()); #endif + QWindowsSockInit winSock; QHostInfo results; |