diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 61a8b6a18c..100e014e99 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -317,6 +317,13 @@ struct QCoreApplicationData { ~QCoreApplicationData() { #ifndef QT_NO_LIBRARY delete app_libpaths; +#endif +#ifndef QT_NO_QOBJECT + // cleanup the QAdoptedThread created for the main() thread + if (QCoreApplicationPrivate::theMainThread) { + QThreadData *data = QThreadData::get2(QCoreApplicationPrivate::theMainThread); + data->deref(); // deletes the data and the adopted thread + } #endif }