aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmldata_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/qml/qqmldata_p.h')
-rw-r--r--src/qml/qml/qqmldata_p.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/qml/qml/qqmldata_p.h b/src/qml/qml/qqmldata_p.h
index dce75c51aa..e271598c2d 100644
--- a/src/qml/qml/qqmldata_p.h
+++ b/src/qml/qml/qqmldata_p.h
@@ -207,8 +207,7 @@ public:
} else if (priv->declarativeData) {
return static_cast<QQmlData *>(priv->declarativeData);
} else if (create) {
- priv->declarativeData = new QQmlData;
- return static_cast<QQmlData *>(priv->declarativeData);
+ return createQQmlData(priv);
} else {
return 0;
}
@@ -231,12 +230,22 @@ public:
static inline void flushPendingBinding(QObject *, QQmlPropertyIndex propertyIndex);
- static QQmlPropertyCache *ensurePropertyCache(QJSEngine *engine, QObject *object);
+ static QQmlPropertyCache *ensurePropertyCache(QJSEngine *engine, QObject *object)
+ {
+ Q_ASSERT(engine);
+ QQmlData *ddata = QQmlData::get(object, /*create*/true);
+ if (Q_LIKELY(ddata->propertyCache))
+ return ddata->propertyCache;
+ return createPropertyCache(engine, object);
+ }
private:
// For attachedProperties
mutable QQmlDataExtended *extendedData;
+ Q_NEVER_INLINE static QQmlData *createQQmlData(QObjectPrivate *priv);
+ Q_NEVER_INLINE static QQmlPropertyCache *createPropertyCache(QJSEngine *engine, QObject *object);
+
void flushPendingBindingImpl(QQmlPropertyIndex index);
Q_ALWAYS_INLINE bool hasBitSet(int bit) const