Ticket #46496: Fix-crash-in-QNetworkAccessCacheBackend-closeDownstr.patch
File Fix-crash-in-QNetworkAccessCacheBackend-closeDownstr.patch, 2.3 KB (added by RJVB (René Bertin), 10 years ago) |
---|
-
qtbase/src/network/access/qnetworkaccesscachebackend.cpp
From 020fc9e9dcd19ef515e48c96e83fd6f75d52684a Mon Sep 17 00:00:00 2001 From: Albert Astals Cid <albert.astals@canonical.com> Date: Thu, 18 Sep 2014 17:59:51 +0200 Subject: [PATCH] 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 --- src/network/access/qnetworkaccesscachebackend.cpp | 6 ------ src/network/access/qnetworkaccesscachebackend_p.h | 1 - .../qnetworkaccessmanager/tst_qnetworkaccessmanager.cpp | 13 +++++++++++++ 3 files changed, 13 insertions(+), 7 deletions(-)
52 52 53 53 QNetworkAccessCacheBackend::QNetworkAccessCacheBackend() 54 54 : QNetworkAccessBackend() 55 , device(0)56 55 { 57 56 } 58 57 … … 125 124 126 125 void QNetworkAccessCacheBackend::closeDownstreamChannel() 127 126 { 128 if (operation() == QNetworkAccessManager::GetOperation) {129 device->close();130 delete device;131 device = 0;132 }133 127 } 134 128 135 129 void QNetworkAccessCacheBackend::closeUpstreamChannel() -
qtbase/src/network/access/qnetworkaccesscachebackend_p.h
75 75 76 76 private: 77 77 bool sendCacheContents(); 78 QIODevice *device;79 78 80 79 }; 81 80 -
qtbase/tests/auto/network/access/qnetworkaccessmanager/tst_qnetworkaccessmanager.cpp
42 42 #include <QtTest/QtTest> 43 43 44 44 #include <QtNetwork/QNetworkAccessManager> 45 #include <QtNetwork/QNetworkReply> 45 46 #ifndef QT_NO_BEARERMANAGEMENT 46 47 #include <QtNetwork/QNetworkConfigurationManager> 47 48 #endif … … 61 62 62 63 private slots: 63 64 void networkAccessible(); 65 void alwaysCacheRequest(); 64 66 }; 65 67 66 68 tst_QNetworkAccessManager::tst_QNetworkAccessManager() … … 126 128 #endif 127 129 } 128 130 131 void tst_QNetworkAccessManager::alwaysCacheRequest() 132 { 133 QNetworkAccessManager manager; 134 135 QNetworkRequest req; 136 req.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::AlwaysCache); 137 QNetworkReply *reply = manager.get(req); 138 reply->close(); 139 delete reply; 140 } 141 129 142 QTEST_MAIN(tst_QNetworkAccessManager) 130 143 #include "tst_qnetworkaccessmanager.moc"