summaryrefslogtreecommitdiffstats
path: root/src/network/access
diff options
context:
space:
mode:
authorMarkus Goetz <Markus.Goetz@nokia.com>2010-06-02 09:56:19 (GMT)
committerMarkus Goetz <Markus.Goetz@nokia.com>2010-06-02 11:00:26 (GMT)
commit417f3a4ece9403d1eb37ce0ecdf74cf670bdd0ff (patch)
treee817bfa5f9f3f81d101563575211e49357b648b6 /src/network/access
parent0f16c7ce8dcd6f4905d14875088c55148e41366a (diff)
downloadQt-417f3a4ece9403d1eb37ce0ecdf74cf670bdd0ff.zip
Qt-417f3a4ece9403d1eb37ce0ecdf74cf670bdd0ff.tar.gz
Qt-417f3a4ece9403d1eb37ce0ecdf74cf670bdd0ff.tar.bz2
QNAM: Improve child deletion order
Delete the QNetworkReply children first because they could access the QAbstractNetworkCache that is also a child of the QNetworkAccessManager. Reviewed-by: brad
Diffstat (limited to 'src/network/access')
-rw-r--r--src/network/access/qnetworkaccessmanager.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp
index 42c64fb..837cf66 100644
--- a/src/network/access/qnetworkaccessmanager.cpp
+++ b/src/network/access/qnetworkaccessmanager.cpp
@@ -464,6 +464,15 @@ QNetworkAccessManager::~QNetworkAccessManager()
#ifndef QT_NO_NETWORKPROXY
delete d_func()->proxyFactory;
#endif
+
+ // Delete the QNetworkReply children first.
+ // Else a QAbstractNetworkCache might get deleted in ~QObject
+ // before a QNetworkReply that accesses the QAbstractNetworkCache
+ // object in its destructor.
+ qDeleteAll(findChildren<QNetworkReply *>());
+ // The other children will be deleted in this ~QObject
+ // FIXME instead of this "hack" make the QNetworkReplyImpl
+ // properly watch the cache deletion, e.g. via a QWeakPointer.
}
#ifndef QT_NO_NETWORKPROXY