summaryrefslogtreecommitdiffstats
path: root/src/network/access/qnetworkaccessmanager.cpp
diff options
context:
space:
mode:
authorMarkus Goetz <Markus.Goetz@nokia.com>2010-06-02 11:56:19 +0200
committerMarkus Goetz <Markus.Goetz@nokia.com>2010-06-02 13:00:26 +0200
commit417f3a4ece9403d1eb37ce0ecdf74cf670bdd0ff (patch)
treee817bfa5f9f3f81d101563575211e49357b648b6 /src/network/access/qnetworkaccessmanager.cpp
parent0f16c7ce8dcd6f4905d14875088c55148e41366a (diff)
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/qnetworkaccessmanager.cpp')
-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 42c64fb718..837cf66dc3 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