diff options
author | Robert Griebl <robert.griebl@pelagicore.com> | 2015-06-17 16:38:47 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-06-23 17:31:51 +0000 |
commit | 1b4f94c8fe0452cc053907fea2ad8be3930df8ce (patch) | |
tree | 3c65361cdeb08ce764979b8e35604f4a84c8f909 /src/qml/qml/ftw/qqmlthread.cpp | |
parent | fcbefee383ccff2a6485acc120631123e30b41dd (diff) |
Force completion of asynchronously loaded components.
[ChangeLog][QtQuick][QQmlComponent] Synchronously complete the loading of a
Asynchronous QQmlComponent, if a PreferSynchronous QQmlComponent is created
for the same url (given that this url does support synchronous loading).
Change-Id: I3291d0569a69bac2aeb4815f1068a426ef2707ef
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qml/qml/ftw/qqmlthread.cpp')
-rw-r--r-- | src/qml/qml/ftw/qqmlthread.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/qml/qml/ftw/qqmlthread.cpp b/src/qml/qml/ftw/qqmlthread.cpp index 4addcd9e58..62f6f76a7e 100644 --- a/src/qml/qml/ftw/qqmlthread.cpp +++ b/src/qml/qml/ftw/qqmlthread.cpp @@ -377,4 +377,31 @@ void QQmlThread::internalPostMethodToMain(Message *message) d->unlock(); } +void QQmlThread::waitForNextMessage() +{ + Q_ASSERT(!isThisThread()); + d->lock(); + Q_ASSERT(d->m_mainThreadWaiting == false); + + d->m_mainThreadWaiting = true; + + if (d->mainSync || !d->threadList.isEmpty()) { + if (d->mainSync) { + QQmlThread::Message *message = d->mainSync; + unlock(); + message->call(this); + delete message; + lock(); + d->mainSync = 0; + wakeOne(); + } else { + d->wait(); + } + } + + d->m_mainThreadWaiting = false; + d->unlock(); +} + + QT_END_NAMESPACE |