aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
diff options
context:
space:
mode:
authorLorn Potter <lorn.potter@gmail.com>2018-05-08 10:41:46 +1000
committerLorn Potter <lorn.potter@gmail.com>2018-05-14 08:22:47 +0000
commit7e22af4bfdfd736e624321924eaae0e0d36940c7 (patch)
treeb4f46f0ee995b2751022c4ddedb2822e106214c0 /src/qml
parent809d305f938177cfb8488dc7fbfc28bc8eef9d20 (diff)
webassembly: fix for crash and assert on no thread and wasm builds
This change requires moveToThread change in qtbase Change-Id: Idf35af4b416f577dabb91f749929dbfe5c88a0f0 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src/qml')
-rw-r--r--src/qml/qml/ftw/qqmlthread.cpp18
-rw-r--r--src/qml/qml/qqmltypeloader.cpp16
2 files changed, 4 insertions, 30 deletions
diff --git a/src/qml/qml/ftw/qqmlthread.cpp b/src/qml/qml/ftw/qqmlthread.cpp
index 9c44e18b87..cffa1b64b0 100644
--- a/src/qml/qml/ftw/qqmlthread.cpp
+++ b/src/qml/qml/ftw/qqmlthread.cpp
@@ -106,9 +106,6 @@ void QQmlThreadPrivate::triggerMainEvent()
{
Q_ASSERT(q->isThisThread());
QCoreApplication::postEvent(&m_mainObject, new QEvent(QEvent::User));
-#ifdef Q_OS_HTML5
- QCoreApplication::processEvents();
-#endif
}
// Trigger even in thread. Must be called from main thread.
@@ -116,9 +113,6 @@ void QQmlThreadPrivate::triggerThreadEvent()
{
Q_ASSERT(!q->isThisThread());
QCoreApplication::postEvent(this, new QEvent(QEvent::User));
-#ifdef Q_OS_HTML5
- QCoreApplication::processEvents();
-#endif
}
bool QQmlThreadPrivate::MainObject::event(QEvent *e)
@@ -329,14 +323,12 @@ void QQmlThread::internalCallMethodInThread(Message *message)
bool wasEmpty = d->threadList.isEmpty();
d->threadList.append(message);
-#ifdef QT_NO_THREAD
- d->mainSync = message;
-#endif
if (wasEmpty && d->m_threadProcessing == false)
d->triggerThreadEvent();
-
-#ifndef QT_NO_THREAD
+#ifdef QT_NO_THREAD
+ message->call(this);
+#else
d->m_mainThreadWaiting = true;
do {
if (d->mainSync) {
@@ -412,10 +404,6 @@ void QQmlThread::waitForNextMessage()
Q_ASSERT(!isThisThread());
d->lock();
Q_ASSERT(d->m_mainThreadWaiting == false);
-
-#ifdef QT_NO_THREAD
- d->triggerThreadEvent();
-#endif
d->m_mainThreadWaiting = true;
if (d->mainSync || !d->threadList.isEmpty()) {
if (d->mainSync) {
diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp
index ed742c3681..1cab827b9f 100644
--- a/src/qml/qml/qqmltypeloader.cpp
+++ b/src/qml/qml/qqmltypeloader.cpp
@@ -495,9 +495,8 @@ The setError() method may only be called from within a QQmlDataBlob callback.
*/
void QQmlDataBlob::addDependency(QQmlDataBlob *blob)
{
-#ifndef Q_OS_HTML5
ASSERT_CALLBACK();
-#endif
+
Q_ASSERT(status() != Null);
if (!blob ||
@@ -1005,12 +1004,7 @@ struct StaticLoader {
void loadThread(QQmlTypeLoader *loader, QQmlDataBlob *blob) const
{
-#ifdef QT_NO_THREAD
- loader->m_thread->loadWithStaticDataAsync(blob, data);
- return;
-#else
loader->loadWithStaticDataThread(blob, data);
-#endif
}
void load(QQmlTypeLoader *loader, QQmlDataBlob *blob) const
{
@@ -1047,9 +1041,6 @@ void QQmlTypeLoader::doLoad(const Loader &loader, QQmlDataBlob *blob, Mode mode)
qWarning("QQmlTypeLoader::doLoad(%s): %s thread", qPrintable(blob->urlString()),
m_thread->isThisThread()?"Compile":"Engine");
#endif
-#ifdef QT_NO_THREAD
- mode = Asynchronous;
-#endif
if (m_thread->isThisThread()) {
unlock();
loader.loadThread(this, blob);
@@ -1688,7 +1679,6 @@ QQmlTypeData *QQmlTypeLoader::getType(const QUrl &url, Mode mode)
} else if ((mode == PreferSynchronous || mode == Synchronous) && QQmlFile::isSynchronous(url)) {
// this was started Asynchronous, but we need to force Synchronous
// completion now (if at all possible with this type of URL).
-#ifndef QT_NO_THREAD
if (!m_thread->isThisThread()) {
// this only works when called directly from the UI thread, but not
// when recursively called on the QML thread via resolveTypes()
@@ -1699,7 +1689,6 @@ QQmlTypeData *QQmlTypeLoader::getType(const QUrl &url, Mode mode)
lock();
}
}
-#endif
}
typeData->addref();
@@ -1713,9 +1702,6 @@ QQmlTypeData will not be cached.
*/
QQmlTypeData *QQmlTypeLoader::getType(const QByteArray &data, const QUrl &url, Mode mode)
{
-#ifdef QT_NO_THREAD
- mode = Asynchronous;
-#endif
LockHolder<QQmlTypeLoader> holder(this);
QQmlTypeData *typeData = new QQmlTypeData(url, this);