summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp10
-rw-r--r--src/corelib/kernel/qcoreapplication_p.h2
2 files changed, 10 insertions, 2 deletions
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 19a33d9637..e00db5e01a 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -334,7 +334,7 @@ Q_GLOBAL_STATIC(QCoreApplicationData, coreappdata)
QCoreApplicationPrivate::QCoreApplicationPrivate(int &aargc, char **aargv, uint flags)
: QObjectPrivate(), argc(aargc), argv(aargv), application_type(0), eventFilter(0),
- in_exec(false), aboutToQuitEmitted(false)
+ in_exec(false), aboutToQuitEmitted(false), threadData_clean(false)
{
app_compile_version = flags & 0xffffff;
#if defined(QT3_SUPPORT)
@@ -362,7 +362,12 @@ QCoreApplicationPrivate::QCoreApplicationPrivate(int &aargc, char **aargv, uint
QCoreApplicationPrivate::~QCoreApplicationPrivate()
{
- if (threadData) {
+ cleanupThreadData();
+}
+
+void QCoreApplicationPrivate::cleanupThreadData()
+{
+ if (threadData && !threadData_clean) {
#ifndef QT_NO_THREAD
void *data = &threadData->tls;
QThreadStorageData::finish((void **)data);
@@ -381,6 +386,7 @@ QCoreApplicationPrivate::~QCoreApplicationPrivate()
threadData->postEventList.clear();
threadData->postEventList.recursion = 0;
threadData->quitNow = false;
+ threadData_clean = true;
}
}
diff --git a/src/corelib/kernel/qcoreapplication_p.h b/src/corelib/kernel/qcoreapplication_p.h
index 804906e6da..22585a1ce9 100644
--- a/src/corelib/kernel/qcoreapplication_p.h
+++ b/src/corelib/kernel/qcoreapplication_p.h
@@ -110,6 +110,7 @@ public:
int &argc;
char **argv;
void appendApplicationPathToLibraryPaths(void);
+ void cleanupThreadData();
#ifndef QT_NO_TRANSLATION
QTranslatorList translators;
@@ -120,6 +121,7 @@ public:
bool in_exec;
bool aboutToQuitEmitted;
+ bool threadData_clean;
QString cachedApplicationDirPath;
QString cachedApplicationFilePath;
#if defined(Q_OS_SYMBIAN)