Fix crash in QNetworkAccessCacheBackend::closeDownstreamChannel
device is private, always null and class has no friends, so no need to have it at all Change-Id: I320d47f1a712a3202c08b494563533e29d185501 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Richard J. Moore <rich@kde.org>
This commit is contained in:
parent
c6c0eb084a
commit
a966b19b52
@ -52,7 +52,6 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
QNetworkAccessCacheBackend::QNetworkAccessCacheBackend()
|
||||
: QNetworkAccessBackend()
|
||||
, device(0)
|
||||
{
|
||||
}
|
||||
|
||||
@ -125,11 +124,6 @@ bool QNetworkAccessCacheBackend::sendCacheContents()
|
||||
|
||||
void QNetworkAccessCacheBackend::closeDownstreamChannel()
|
||||
{
|
||||
if (operation() == QNetworkAccessManager::GetOperation) {
|
||||
device->close();
|
||||
delete device;
|
||||
device = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void QNetworkAccessCacheBackend::closeUpstreamChannel()
|
||||
|
@ -75,7 +75,6 @@ public:
|
||||
|
||||
private:
|
||||
bool sendCacheContents();
|
||||
QIODevice *device;
|
||||
|
||||
};
|
||||
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include <QtTest/QtTest>
|
||||
|
||||
#include <QtNetwork/QNetworkAccessManager>
|
||||
#include <QtNetwork/QNetworkReply>
|
||||
#ifndef QT_NO_BEARERMANAGEMENT
|
||||
#include <QtNetwork/QNetworkConfigurationManager>
|
||||
#endif
|
||||
@ -61,6 +62,7 @@ public:
|
||||
|
||||
private slots:
|
||||
void networkAccessible();
|
||||
void alwaysCacheRequest();
|
||||
};
|
||||
|
||||
tst_QNetworkAccessManager::tst_QNetworkAccessManager()
|
||||
@ -126,5 +128,16 @@ void tst_QNetworkAccessManager::networkAccessible()
|
||||
#endif
|
||||
}
|
||||
|
||||
void tst_QNetworkAccessManager::alwaysCacheRequest()
|
||||
{
|
||||
QNetworkAccessManager manager;
|
||||
|
||||
QNetworkRequest req;
|
||||
req.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::AlwaysCache);
|
||||
QNetworkReply *reply = manager.get(req);
|
||||
reply->close();
|
||||
delete reply;
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_QNetworkAccessManager)
|
||||
#include "tst_qnetworkaccessmanager.moc"
|
||||
|
Loading…
Reference in New Issue
Block a user