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.cpp27
1 files changed, 17 insertions, 10 deletions
diff --git a/src/qml/qml/ftw/qqmlthread.cpp b/src/qml/qml/ftw/qqmlthread.cpp
index ffa6e29290..cae7088840 100644
--- a/src/qml/qml/ftw/qqmlthread.cpp
+++ b/src/qml/qml/ftw/qqmlthread.cpp
@@ -233,20 +233,27 @@ void QQmlThread::shutdown()
{
d->lock();
Q_ASSERT(!d->m_shutdown);
- d->m_shutdown = true;
- if (d->threadList.isEmpty() && d->m_threadProcessing == false) {
- if (QCoreApplication::closingDown()) {
- d->quit();
+
+ for (;;) {
+ if (d->mainSync || !d->mainList.isEmpty()) {
d->unlock();
- d->QThread::wait();
- return;
+ d->mainEvent();
+ d->lock();
+ } else if (!d->threadList.isEmpty()) {
+ d->wait();
} else {
- d->triggerThreadEvent();
+ break;
}
- } else if (d->mainSync) {
- d->wakeOne();
}
- d->wait();
+
+ d->m_shutdown = true;
+ if (QCoreApplication::closingDown()) {
+ d->quit();
+ } else {
+ d->triggerThreadEvent();
+ d->wait();
+ }
+
d->unlock();
d->QThread::wait();
}