diff options
Diffstat (limited to 'src/qmlworkerscript/qquickworkerscript.cpp')
-rw-r--r-- | src/qmlworkerscript/qquickworkerscript.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/qmlworkerscript/qquickworkerscript.cpp b/src/qmlworkerscript/qquickworkerscript.cpp index 8df631c6d3..f892343b85 100644 --- a/src/qmlworkerscript/qquickworkerscript.cpp +++ b/src/qmlworkerscript/qquickworkerscript.cpp @@ -180,8 +180,8 @@ bool QQuickWorkerScriptEnginePrivate::event(QEvent *event) } else if (event->type() == (QEvent::Type)WorkerRemoveEvent::WorkerRemove) { QMutexLocker locker(&m_lock); WorkerRemoveEvent *workerEvent = static_cast<WorkerRemoveEvent *>(event); - auto itr = workers.find(workerEvent->workerId()); - if (itr != workers.end()) { + auto itr = workers.constFind(workerEvent->workerId()); + if (itr != workers.cend()) { if (itr->isT1()) delete itr->asT1(); workers.erase(itr); @@ -255,7 +255,7 @@ void QQuickWorkerScriptEnginePrivate::processLoad(int id, const QUrl &url) if (fileName.endsWith(QLatin1String(".mjs"))) { auto module = engine->loadModule(url); if (module.compiled) { - if (module.compiled->instantiate(engine)) + if (module.compiled->instantiate()) module.compiled->evaluate(); } else if (module.native) { // Nothing to do. There is no global code in a native module. @@ -417,8 +417,8 @@ int QQuickWorkerScriptEngine::registerWorkerScript(QQuickWorkerScript *owner) void QQuickWorkerScriptEngine::removeWorkerScript(int id) { - const auto it = d->workers.find(id); - if (it == d->workers.end()) + const auto it = d->workers.constFind(id); + if (it == d->workers.cend()) return; if (it->isT1()) { @@ -508,9 +508,6 @@ void QQuickWorkerScriptEngine::run() Worker scripts that are plain JavaScript sources can not use \l {qtqml-javascript-imports.html}{.import} syntax. Scripts that are ECMAScript modules can freely use import and export statements. - - \sa {Qt Quick Examples - Threading}, - {Threaded ListModel Example} */ QQuickWorkerScript::QQuickWorkerScript(QObject *parent) : QObject(parent), m_engine(nullptr), m_scriptId(-1), m_componentComplete(true) @@ -583,7 +580,7 @@ bool QQuickWorkerScript::ready() const of ListModel objects, any modifications by the other thread to an object passed in \c message will not be reflected in the original object. */ -void QQuickWorkerScript::sendMessage(QQmlV4Function *args) +void QQuickWorkerScript::sendMessage(QQmlV4FunctionPtr args) { if (!engine()) { qWarning("QQuickWorkerScript: Attempt to send message before WorkerScript establishment"); |