From 7e22af4bfdfd736e624321924eaae0e0d36940c7 Mon Sep 17 00:00:00 2001 From: Lorn Potter Date: Tue, 8 May 2018 10:41:46 +1000 Subject: 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 --- src/qml/qml/ftw/qqmlthread.cpp | 18 +++--------------- src/qml/qml/qqmltypeloader.cpp | 16 +--------------- 2 files changed, 4 insertions(+), 30 deletions(-) (limited to 'src/qml/qml') 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 { @@ -1046,9 +1040,6 @@ void QQmlTypeLoader::doLoad(const Loader &loader, QQmlDataBlob *blob, Mode mode) #ifdef DATABLOB_DEBUG 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(); @@ -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 holder(this); QQmlTypeData *typeData = new QQmlTypeData(url, this); -- cgit v1.2.3