aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/ftw/qqmlthread.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/qml/ftw/qqmlthread.cpp')
-rw-r--r--src/qml/qml/ftw/qqmlthread.cpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/qml/qml/ftw/qqmlthread.cpp b/src/qml/qml/ftw/qqmlthread.cpp
index 397b4851cf..b3d7bddff7 100644
--- a/src/qml/qml/ftw/qqmlthread.cpp
+++ b/src/qml/qml/ftw/qqmlthread.cpp
@@ -139,6 +139,7 @@ void QQmlThreadPrivate::run()
q->startupThread();
exec();
+ q->shutdownThread();
}
void QQmlThreadPrivate::mainEvent()
@@ -177,7 +178,6 @@ void QQmlThreadPrivate::threadEvent()
quit();
wakeOne();
unlock();
- q->shutdownThread();
return;
} else if (!threadList.isEmpty()) {
@@ -207,12 +207,6 @@ void QQmlThreadPrivate::threadEvent()
QQmlThread::QQmlThread()
: d(new QQmlThreadPrivate(this))
{
- d->lock();
- d->start();
- d->wait();
- d->unlock();
- d->moveToThread(d);
-
}
QQmlThread::~QQmlThread()
@@ -220,13 +214,29 @@ QQmlThread::~QQmlThread()
delete d;
}
+void QQmlThread::startup()
+{
+ d->lock();
+ d->start();
+ d->wait();
+ d->unlock();
+ d->moveToThread(d);
+}
+
void QQmlThread::shutdown()
{
d->lock();
Q_ASSERT(!d->m_shutdown);
d->m_shutdown = true;
if (d->threadList.isEmpty() && d->m_threadProcessing == false) {
- d->triggerThreadEvent();
+ if (QCoreApplication::closingDown()) {
+ d->quit();
+ d->unlock();
+ d->QThread::wait();
+ return;
+ } else {
+ d->triggerThreadEvent();
+ }
} else if (d->mainSync) {
d->wakeOne();
}