summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel
diff options
context:
space:
mode:
authorAndré Klitzing <aklitzing@gmail.com>2020-05-19 12:50:35 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2020-06-23 18:36:25 +0000
commitc2ef25450a5983cff88a643370382110b56667f5 (patch)
tree27b77b5bebe7fae1681d3e15dbcb606840844d8e /src/corelib/kernel
parent47fbaf061f32c47ccd5dbbf8b19d695222b21795 (diff)
Fix living QObject after shutdown of QCoreApplication
QThreadPool is a QObject and must be deleted if the QCoreApplication is being destroyed to release the underlying ThreadData. A Q_GLOBAL_STATIC won't release any memory is not able to manually release it. Task-number: QTBUG-84234 Change-Id: Ia82bcff2b564b753ed687f025ff86fa1bed1e64c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 1304040e5d5af0575cac43aaf1424f72472c7b23) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 5fdcc9b914..a97b68f372 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -878,8 +878,10 @@ QCoreApplication::~QCoreApplication()
} QT_CATCH (...) {
// swallow the exception, since destructors shouldn't throw
}
- if (globalThreadPool)
+ if (globalThreadPool) {
globalThreadPool->waitForDone();
+ delete globalThreadPool;
+ }
#endif
#ifndef QT_NO_QOBJECT