summaryrefslogtreecommitdiffstats
path: root/src/network/access/qnetworkreplyimpl_p.h
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@accenture.com>2011-09-14 13:07:06 (GMT)
committerShane Kearns <shane.kearns@accenture.com>2011-09-14 13:31:19 (GMT)
commitc4cab7199590cc6b1901334e8ff604cd876fccee (patch)
tree9a78be3e822dfa2809f0dab6672f3a88156c6334 /src/network/access/qnetworkreplyimpl_p.h
parentadfa2dde84ff7ed1a8b177c2a7e885e752e9bb0b (diff)
downloadQt-c4cab7199590cc6b1901334e8ff604cd876fccee.zip
Qt-c4cab7199590cc6b1901334e8ff604cd876fccee.tar.gz
Qt-c4cab7199590cc6b1901334e8ff604cd876fccee.tar.bz2
Prevent crash when cache is changed on the fly
Calling QNetworkAccessManager::setCache while there were requests being processed using the existing cache caused crashes due to deleting the old cache invalidating pointers to the cache data streams (QTemporaryFile in case of QNetworkDiskCache). Using pointer to deleted data caused a crash in some cases. It has undefined behaviour because the memory may have been overwritten or decommitted. To fix this, use the deleted signal to notify QNetworkReplyImpl that the cache has been destroyed. It then clears the pointer to the data stream and disables caching. This avoids the crash that previously happened when trying to write to the cache file. Task-number: QT-5252 Reviewed-by: Peter Hartmann
Diffstat (limited to 'src/network/access/qnetworkreplyimpl_p.h')
-rw-r--r--src/network/access/qnetworkreplyimpl_p.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/network/access/qnetworkreplyimpl_p.h b/src/network/access/qnetworkreplyimpl_p.h
index 31da297..0e4ff8f 100644
--- a/src/network/access/qnetworkreplyimpl_p.h
+++ b/src/network/access/qnetworkreplyimpl_p.h
@@ -103,6 +103,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
@@ -139,6 +140,7 @@ public:
void _q_networkSessionConnected();
void _q_networkSessionFailed();
#endif
+ void _q_cacheDestroyed();
void setup(QNetworkAccessManager::Operation op, const QNetworkRequest &request,
QIODevice *outgoingData);