aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qml/compiler/qqmlpropertycachecreator_p.h3
-rw-r--r--tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp44
2 files changed, 47 insertions, 0 deletions
diff --git a/src/qml/compiler/qqmlpropertycachecreator_p.h b/src/qml/compiler/qqmlpropertycachecreator_p.h
index 557a1364f1..a1b0a14890 100644
--- a/src/qml/compiler/qqmlpropertycachecreator_p.h
+++ b/src/qml/compiler/qqmlpropertycachecreator_p.h
@@ -567,6 +567,9 @@ inline void QQmlPropertyCacheAliasCreator<ObjectContainer>::appendAliasPropertie
const int targetObjectIndex = objectForId(component, alias->targetObjectId);
Q_ASSERT(targetObjectIndex >= 0);
+ if (alias->aliasToLocalAlias)
+ continue;
+
if (alias->encodedMetaPropertyIndex == -1)
continue;
diff --git a/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp b/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp
index c3a80eebde..dd23dfca07 100644
--- a/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp
+++ b/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp
@@ -51,6 +51,7 @@ private slots:
void basicVersionChecks();
void recompileAfterChange();
void fileSelectors();
+ void localAliases();
};
// A wrapper around QQmlComponent to ensure the temporary reference counts
@@ -485,6 +486,49 @@ void tst_qmldiskcache::fileSelectors()
}
}
+void tst_qmldiskcache::localAliases()
+{
+ QQmlEngine engine;
+
+ TestCompiler testCompiler(&engine);
+ QVERIFY(testCompiler.tempDir.isValid());
+
+ const QByteArray contents = QByteArrayLiteral("import QtQml 2.0\n"
+ "QtObject {\n"
+ " id: root\n"
+ " property int prop: 100\n"
+ " property alias dummy1: root.prop\n"
+ " property alias dummy2: root.prop\n"
+ " property alias dummy3: root.prop\n"
+ " property alias dummy4: root.prop\n"
+ " property alias dummy5: root.prop\n"
+ " property alias foo: root.prop\n"
+ " property alias bar: root.foo\n"
+ "}");
+
+ {
+ testCompiler.clearCache();
+ QVERIFY2(testCompiler.compile(contents), qPrintable(testCompiler.lastErrorString));
+ QVERIFY2(testCompiler.verify(), qPrintable(testCompiler.lastErrorString));
+ }
+
+ {
+ CleanlyLoadingComponent component(&engine, testCompiler.testFilePath);
+ QScopedPointer<QObject> obj(component.create());
+ QVERIFY(!obj.isNull());
+ QCOMPARE(obj->property("bar").toInt(), 100);
+ }
+
+ engine.clearComponentCache();
+
+ {
+ CleanlyLoadingComponent component(&engine, testCompiler.testFilePath);
+ QScopedPointer<QObject> obj(component.create());
+ QVERIFY(!obj.isNull());
+ QCOMPARE(obj->property("bar").toInt(), 100);
+ }
+}
+
QTEST_MAIN(tst_qmldiskcache)
#include "tst_qmldiskcache.moc"