diff options
-rw-r--r-- | src/qml/qml/qqmlengine.cpp | 10 | ||||
-rw-r--r-- | src/qml/qml/qqmlnotifier.cpp | 4 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index 1f4e5528c7..cad78f9bb7 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -812,10 +812,12 @@ void QQmlData::signalEmitted(QAbstractDeclarativeData *, QObject *object, int in // QQmlEngine to emit signals from a different thread. These signals are then automatically // marshalled back onto the QObject's thread and handled by QML from there. This is tested // by the qqmlecmascript::threadSignal() autotest. - if (ddata->notifyList && - QThread::currentThreadId() != QObjectPrivate::get(object)->getThreadData()->threadId.loadRelaxed()) { + if (!ddata->notifyList) + return; - if (!QObjectPrivate::get(object)->getThreadData()->thread.loadAcquire()) + auto objectThreadData = QObjectPrivate::get(object)->threadData.loadRelaxed(); + if (QThread::currentThreadId() != objectThreadData->threadId.loadRelaxed()) { + if (!objectThreadData->thread.loadAcquire()) return; QMetaMethod m = QMetaObjectPrivate::signal(object->metaObject(), index); @@ -847,7 +849,7 @@ void QQmlData::signalEmitted(QAbstractDeclarativeData *, QObject *object, int in QQmlThreadNotifierProxyObject *mpo = new QQmlThreadNotifierProxyObject; mpo->target = object; - mpo->moveToThread(QObjectPrivate::get(object)->getThreadData()->thread.loadAcquire()); + mpo->moveToThread(objectThreadData->thread.loadAcquire()); QCoreApplication::postEvent(mpo, ev.take()); } else { diff --git a/src/qml/qml/qqmlnotifier.cpp b/src/qml/qml/qqmlnotifier.cpp index fe839a50dc..df3731684a 100644 --- a/src/qml/qml/qqmlnotifier.cpp +++ b/src/qml/qml/qqmlnotifier.cpp @@ -118,8 +118,8 @@ void QQmlNotifierEndpoint::connect(QObject *source, int sourceSignal, QQmlEngine disconnect(); Q_ASSERT(engine); - if (QObjectPrivate::get(source)->getThreadData()->threadId.loadRelaxed() != - QObjectPrivate::get(engine)->getThreadData()->threadId.loadRelaxed()) { + if (QObjectPrivate::get(source)->threadData.loadRelaxed()->threadId.loadRelaxed() != + QObjectPrivate::get(engine)->threadData.loadRelaxed()->threadId.loadRelaxed()) { QString sourceName; QDebug(&sourceName) << source; |