From bd42c14963f1434eb8ca7ba2a432a2f9f970f80a Mon Sep 17 00:00:00 2001 From: jian liang Date: Thu, 21 Mar 2013 23:24:36 +0800 Subject: Make sure QThreadData and QAdoptedThread object is destroyed at app exit Task-number: QTBUG-30134 Restore the lines in qcoreapplication.cpp removed by commit 950b35cf97ad398f97883efd2a18ee97994a8a9c to ensure QThreadData and QAdoptedThread object of main thread is destroyed at application exit. We don't set QCoreApplicationPriavte::theMainThread to 0 as before since it will be set to zero in QThreadData::~QThreadData() Cherry-picked from qtbase/7dc622290bb8e81af634034f443e25be0d6d48a3. Change-Id: I6bc62235d0aff7818ca9a9cad45625b2777afc55 Reviewed-by: jian liang Reviewed-by: Thiago Macieira --- src/corelib/kernel/qcoreapplication.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 8ed8f56..0bf26ad 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -373,6 +373,13 @@ struct 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 } #ifdef Q_OS_BLACKBERRY -- cgit v0.12