diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2017-07-20 11:42:45 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2017-08-02 18:15:23 +0000 |
commit | 2aabfa28a5fa4a7a0a5c5f47872df19f84551fab (patch) | |
tree | a50d62b64bb127c9ad736a14ec2ef51f43d59936 /src/qml/qml/qqmlpropertycache.cpp | |
parent | a4be64a06c94765f995d49be00eb8fc9bed83958 (diff) |
Avoid meta-object creation when looking up QML properties in the property cache
When looking up QML properties in the property cache, we also need to
verify that they should be visible in the QML context they are requested
from, i.e. if the revision of the object in that context has the
property visible or not. That requires retrieving the VME meta-object
for QML declared properties. We can retrieve that directly from the
QObjectPrivate instead of going through the potential meta-object
builder creation path.
Task-number: QTBUG-61536
Change-Id: I695921d625169de5c58941087464beb5367fb2db
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlpropertycache.cpp')
-rw-r--r-- | src/qml/qml/qqmlpropertycache.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/qml/qml/qqmlpropertycache.cpp b/src/qml/qml/qqmlpropertycache.cpp index 9a495e6fa3..019fa654d1 100644 --- a/src/qml/qml/qqmlpropertycache.cpp +++ b/src/qml/qml/qqmlpropertycache.cpp @@ -764,7 +764,11 @@ void QQmlPropertyCache::invalidate(const QMetaObject *metaObject) QQmlPropertyData *QQmlPropertyCache::findProperty(StringCache::ConstIterator it, QObject *object, QQmlContextData *context) const { QQmlData *data = (object ? QQmlData::get(object) : 0); - const QQmlVMEMetaObject *vmemo = (data && data->hasVMEMetaObject ? static_cast<const QQmlVMEMetaObject *>(object->metaObject()) : 0); + const QQmlVMEMetaObject *vmemo = 0; + if (data && data->hasVMEMetaObject) { + QObjectPrivate *op = QObjectPrivate::get(object); + vmemo = static_cast<const QQmlVMEMetaObject *>(op->metaObject); + } return findProperty(it, vmemo, context); } @@ -808,9 +812,9 @@ QQmlPropertyData *QQmlPropertyCache::findProperty(StringCache::ConstIterator it, } if (vmemo) { - const int methodCount = vmemo->methodCount(); - const int signalCount = vmemo->signalCount(); - const int propertyCount = vmemo->propertyCount(); + const int methodCount = vmemo->cache->methodCount(); + const int signalCount = vmemo->cache->signalCount(); + const int propertyCount = vmemo->cache->propertyCount(); // Ensure that the property we resolve to is accessible from this meta-object do { |