summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/declarative/qml/qmlvmemetaobject.cpp2
-rw-r--r--tests/auto/declarative/qmllanguage/data/NestedAlias.qml14
-rw-r--r--tests/auto/declarative/qmllanguage/data/alias.6.qml8
-rw-r--r--tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp10
4 files changed, 32 insertions, 2 deletions
diff --git a/src/declarative/qml/qmlvmemetaobject.cpp b/src/declarative/qml/qmlvmemetaobject.cpp
index 62a2a6b..05a6f58 100644
--- a/src/declarative/qml/qmlvmemetaobject.cpp
+++ b/src/declarative/qml/qmlvmemetaobject.cpp
@@ -191,8 +191,6 @@ int QmlVMEMetaObject::metaCall(QMetaObject::Call c, int _id, void **a)
if (id < metaData->aliasCount) {
- QmlContext *ctxt = qmlContext(object);
-
if (!ctxt) return -1;
QmlVMEMetaData::AliasData *d = metaData->aliasData() + id;
QmlContextPrivate *ctxtPriv =
diff --git a/tests/auto/declarative/qmllanguage/data/NestedAlias.qml b/tests/auto/declarative/qmllanguage/data/NestedAlias.qml
new file mode 100644
index 0000000..93a5454
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/NestedAlias.qml
@@ -0,0 +1,14 @@
+import Qt 4.6
+
+Object {
+ property Object o1
+ property Object o2
+
+ property alias a: object2.a
+
+ o1: Object { id: object1 }
+ o2: Object {
+ id: object2
+ property int a: 1923
+ }
+}
diff --git a/tests/auto/declarative/qmllanguage/data/alias.6.qml b/tests/auto/declarative/qmllanguage/data/alias.6.qml
new file mode 100644
index 0000000..aac0ef3
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/alias.6.qml
@@ -0,0 +1,8 @@
+import Qt 4.6
+
+Object {
+ property Object o;
+ property alias a: object.a
+ o: NestedAlias { id: object }
+}
+
diff --git a/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp b/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp
index 97038e6..d51bbcc 100644
--- a/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp
+++ b/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp
@@ -680,6 +680,16 @@ void tst_qmllanguage::aliasProperties()
delete object;
}
+
+ // Nested aliases - this used to cause a crash
+ {
+ QmlComponent component(&engine, TEST_FILE("alias.6.qml"));
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("a").toInt(), 1923);
+ }
}
// Test that the root element in a composite type can be a Component