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.cpp41
1 files changed, 27 insertions, 14 deletions
diff --git a/src/qml/qml/ftw/qqmlthread.cpp b/src/qml/qml/ftw/qqmlthread.cpp
index 3accb9dce5..1ea3f25405 100644
--- a/src/qml/qml/ftw/qqmlthread.cpp
+++ b/src/qml/qml/ftw/qqmlthread.cpp
@@ -179,15 +179,17 @@ void QQmlThreadPrivate::threadEvent()
{
lock();
- if (m_shutdown) {
- quit();
- wakeOne();
- unlock();
- q->shutdownThread();
- } else {
- m_threadProcessing = true;
+ for (;;) {
+ if (m_shutdown) {
+ quit();
+ wakeOne();
+ unlock();
+ q->shutdownThread();
+
+ return;
+ } else if (!threadList.isEmpty()) {
+ m_threadProcessing = true;
- while (!threadList.isEmpty()) {
QQmlThread::Message *message = threadList.first();
unlock();
@@ -197,13 +199,15 @@ void QQmlThreadPrivate::threadEvent()
lock();
delete threadList.takeFirst();
- }
+ } else {
+ wakeOne();
- wakeOne();
+ m_threadProcessing = false;
- m_threadProcessing = false;
+ unlock();
- unlock();
+ return;
+ }
}
}
@@ -228,8 +232,11 @@ void QQmlThread::shutdown()
d->lock();
Q_ASSERT(!d->m_shutdown);
d->m_shutdown = true;
- if (d->threadList.isEmpty() && d->m_threadProcessing == false)
+ if (d->threadList.isEmpty() && d->m_threadProcessing == false) {
d->triggerThreadEvent();
+ } else if (d->mainSync) {
+ d->wakeOne();
+ }
d->wait();
d->unlock();
d->QThread::wait();
@@ -333,8 +340,14 @@ void QQmlThread::internalCallMethodInMain(Message *message)
d->triggerMainEvent();
}
- while (d->mainSync && !d->m_shutdown)
+ while (d->mainSync) {
+ if (d->m_shutdown) {
+ delete d->mainSync;
+ d->mainSync = 0;
+ break;
+ }
d->wait();
+ }
d->unlock();
}