diff options
Diffstat (limited to 'src/qml/compiler')
-rw-r--r-- | src/qml/compiler/qqmlcodegenerator.cpp | 9 | ||||
-rw-r--r-- | src/qml/compiler/qqmlcodegenerator_p.h | 2 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/qml/compiler/qqmlcodegenerator.cpp b/src/qml/compiler/qqmlcodegenerator.cpp index c16dd5daea..2215551b95 100644 --- a/src/qml/compiler/qqmlcodegenerator.cpp +++ b/src/qml/compiler/qqmlcodegenerator.cpp @@ -1292,7 +1292,7 @@ QVector<int> JSCodeGen::generateJSCodeForFunctionsAndBindings(const QList<AST::N return runtimeFunctionIndices; } -static QQmlPropertyData *lookupQmlCompliantProperty(QQmlPropertyCache *cache, const QString &name, bool *propertyExistsButForceNameLookup = 0) +QQmlPropertyData *JSCodeGen::lookupQmlCompliantProperty(QQmlPropertyCache *cache, const QString &name, bool *propertyExistsButForceNameLookup) { if (propertyExistsButForceNameLookup) *propertyExistsButForceNameLookup = false; @@ -1308,6 +1308,13 @@ static QQmlPropertyData *lookupQmlCompliantProperty(QQmlPropertyCache *cache, co if (pd && !cache->isAllowedInRevision(pd)) pd = 0; + // Return a copy allocated from our memory pool. Property data pointers can change + // otherwise when the QQmlPropertyCache changes later in the QML type compilation process. + if (pd) { + QQmlPropertyData *copy = pd; + pd = _function->New<QQmlPropertyData>(); + *pd = *copy; + } return pd; } diff --git a/src/qml/compiler/qqmlcodegenerator_p.h b/src/qml/compiler/qqmlcodegenerator_p.h index 1cc5b1e2f6..a5fec65111 100644 --- a/src/qml/compiler/qqmlcodegenerator_p.h +++ b/src/qml/compiler/qqmlcodegenerator_p.h @@ -371,6 +371,8 @@ protected: virtual V4IR::Expr *fallbackNameLookup(const QString &name, int line, int col); private: + QQmlPropertyData *lookupQmlCompliantProperty(QQmlPropertyCache *cache, const QString &name, bool *propertyExistsButForceNameLookup = 0); + QQmlEnginePrivate *engine; QString sourceCode; QQmlJS::Engine *jsEngine; // needed for memory pool |