diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2021-12-14 16:16:20 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2021-12-16 20:03:31 +0000 |
commit | de587f1c55ce27ed332e0810eb8768b287212bcf (patch) | |
tree | 1f0ed27cefbfe08248b5fe2a62d70f489e33dbbb /src/qml/qml/qqml.cpp | |
parent | e95a43fb7666d6cf6095598c8bb9bbc1de9c3eb3 (diff) |
Do not copy lookups
It leads to data corruption. Also, be more careful about releasing the
property cache. We can only do that if the qobjectlookup member of the
union is active. Unfortunately we have to do a number of checks now, to
make sure it is. In order to still keep the checks inline, we move some
functions around.
Pick-to: 6.2 6.3
Fixes: QTBUG-99211
Change-Id: If6dd879e67b172e1a9035e83fbfacbe73c6c7476
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/qml/qqml.cpp')
-rw-r--r-- | src/qml/qml/qqml.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/qml/qml/qqml.cpp b/src/qml/qml/qqml.cpp index 05ad7d9db2..4efda0f5d5 100644 --- a/src/qml/qml/qqml.cpp +++ b/src/qml/qml/qqml.cpp @@ -929,7 +929,7 @@ bool AOTCompiledContext::captureLookup(uint index, QObject *object) const QV4::Lookup *l = compilationUnit->runtimeLookups + index; if (l->getter != QV4::QQmlTypeWrapper::lookupSingletonProperty - && l->getter != QV4::QObjectWrapper::lookupGetter) { + && l->getter != QV4::Lookup::getterQObject) { return false; } @@ -959,8 +959,8 @@ QMetaType AOTCompiledContext::lookupResultMetaType(uint index) const if (l->qmlContextPropertyGetter == QV4::QQmlContextWrapper::lookupScopeObjectProperty || l->qmlContextPropertyGetter == QV4::QQmlContextWrapper::lookupContextObjectProperty || l->getter == QV4::QQmlTypeWrapper::lookupSingletonProperty - || l->getter == QV4::QObjectWrapper::lookupGetter - || l->setter == QV4::QObjectWrapper::lookupSetter) { + || l->getter == QV4::Lookup::getterQObject + || l->setter == QV4::Lookup::setterQObject) { return l->qobjectLookup.propertyData->propType(); } else if (l->getter == QV4::QQmlValueTypeWrapper::lookupGetter) { return QMetaType(l->qgadgetLookup.metaType); @@ -1343,7 +1343,7 @@ bool AOTCompiledContext::getObjectLookup(uint index, QObject *object, void *targ if (!object) return doThrow(); - if (l->getter != QV4::QObjectWrapper::lookupGetter) + if (l->getter != QV4::Lookup::getterQObject) return false; switch (loadObjectProperty(l, object, target, qmlContext)) { @@ -1367,7 +1367,7 @@ void AOTCompiledContext::initGetObjectLookup(uint index, QObject *object, QMetaT } else { QV4::Lookup *l = compilationUnit->runtimeLookups + index; if (initObjectLookup(this, l, object, type)) - l->getter = QV4::QObjectWrapper::lookupGetter; + l->getter = QV4::Lookup::getterQObject; else engine->handle()->throwTypeError(); } @@ -1437,7 +1437,7 @@ bool AOTCompiledContext::setObjectLookup(uint index, QObject *object, void *valu return doThrow(); QV4::Lookup *l = compilationUnit->runtimeLookups + index; - if (l->setter != QV4::QObjectWrapper::lookupSetter) + if (l->setter != QV4::Lookup::setterQObject) return false; switch (storeObjectProperty(l, object, value)) { @@ -1461,7 +1461,7 @@ void AOTCompiledContext::initSetObjectLookup(uint index, QObject *object, QMetaT } else { QV4::Lookup *l = compilationUnit->runtimeLookups + index; if (initObjectLookup(this, l, object, type)) - l->setter = QV4::QObjectWrapper::lookupSetter; + l->setter = QV4::Lookup::setterQObject; else engine->handle()->throwTypeError(); } |