summaryrefslogtreecommitdiffstats
path: root/src/network/kernel/qhostinfo.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2010-04-19 19:39:00 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2010-04-20 09:24:55 (GMT)
commit2c961fcf39c991ee461a35aa62158cdd3ac8e9f8 (patch)
tree7973e79e7fa6d8a438df08e0a8938b696ed6d83d /src/network/kernel/qhostinfo.cpp
parentc4c75ebd65454fd27bffefb4a3468ece20990c86 (diff)
downloadQt-2c961fcf39c991ee461a35aa62158cdd3ac8e9f8.zip
Qt-2c961fcf39c991ee461a35aa62158cdd3ac8e9f8.tar.gz
Qt-2c961fcf39c991ee461a35aa62158cdd3ac8e9f8.tar.bz2
[tst_qhostinfo] Properly clean up the cache and lookup threads.
Ensure that one test won't interfere with the next Reviewed-by: Markus Goetz
Diffstat (limited to 'src/network/kernel/qhostinfo.cpp')
-rw-r--r--src/network/kernel/qhostinfo.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/network/kernel/qhostinfo.cpp b/src/network/kernel/qhostinfo.cpp
index baf69e7..7e006e0 100644
--- a/src/network/kernel/qhostinfo.cpp
+++ b/src/network/kernel/qhostinfo.cpp
@@ -488,9 +488,23 @@ QHostInfoLookupManager::~QHostInfoLookupManager()
wasDeleted = true;
// don't qDeleteAll currentLookups, the QThreadPool has ownership
- qDeleteAll(postponedLookups);
- qDeleteAll(scheduledLookups);
- qDeleteAll(finishedLookups);
+ clear();
+}
+
+void QHostInfoLookupManager::clear()
+{
+ {
+ QMutexLocker locker(&mutex);
+ qDeleteAll(postponedLookups);
+ qDeleteAll(scheduledLookups);
+ qDeleteAll(finishedLookups);
+ postponedLookups.clear();
+ scheduledLookups.clear();
+ finishedLookups.clear();
+ }
+
+ threadPool.waitForDone();
+ cache.clear();
}
void QHostInfoLookupManager::work()
@@ -636,7 +650,7 @@ void qt_qhostinfo_clear_cache()
{
QHostInfoLookupManager* manager = theHostInfoLookupManager();
if (manager) {
- manager->cache.clear();
+ manager->clear();
}
}