diff options
Diffstat (limited to 'src/corelib/thread')
-rw-r--r-- | src/corelib/thread/qthreadpool.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/corelib/thread/qthreadpool.cpp b/src/corelib/thread/qthreadpool.cpp index 1b417aa8be..5765bf6b09 100644 --- a/src/corelib/thread/qthreadpool.cpp +++ b/src/corelib/thread/qthreadpool.cpp @@ -325,7 +325,8 @@ bool QThreadPoolPrivate::waitForDone(int msecs) void QThreadPoolPrivate::clear() { QMutexLocker locker(&mutex); - for (QueuePage *page : qAsConst(queue)) { + while (!queue.isEmpty()) { + auto *page = queue.takeLast(); while (!page->isFinished()) { QRunnable *r = page->pop(); if (r && r->autoDelete()) { @@ -335,9 +336,8 @@ void QThreadPoolPrivate::clear() locker.relock(); } } + delete page; } - qDeleteAll(queue); - queue.clear(); } /*! |