summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/thread/qthreadpool.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/corelib/thread/qthreadpool.cpp b/src/corelib/thread/qthreadpool.cpp
index 4c705f5a93..a923b8aa41 100644
--- a/src/corelib/thread/qthreadpool.cpp
+++ b/src/corelib/thread/qthreadpool.cpp
@@ -269,9 +269,9 @@ void QThreadPoolPrivate::reset()
runnableReady.wakeAll();
while (!allThreads.empty()) {
- // make a copy of the set so that we can iterate without the lock
- QSet<QThreadPoolThread *> allThreadsCopy = allThreads;
- allThreads.clear();
+ // move the contents of the set out so that we can iterate without the lock
+ QSet<QThreadPoolThread *> allThreadsCopy;
+ allThreadsCopy.swap(allThreads);
locker.unlock();
foreach (QThreadPoolThread *thread, allThreadsCopy) {