From: Michael Brasser Date: Mon, 12 Mar 2012 05:27:09 +0000 (+1000) Subject: Fix v4 nested object access bug. X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=b0215058436a39953d8702c1671561175af91a6c;p=konrad%2Fqtdeclarative.git Fix v4 nested object access bug. Use the correct type to look up the sub property. Task-number: QTBUG-24606 Change-Id: Iab372ca7440249241bf855d2875a947ad8fe4527 Reviewed-by: Chris Adams Reviewed-by: Roberto Raggi --- diff --git a/src/qml/qml/v4/qv4irbuilder.cpp b/src/qml/qml/v4/qv4irbuilder.cpp index 36e88e5..06f4024 100644 --- a/src/qml/qml/v4/qv4irbuilder.cpp +++ b/src/qml/qml/v4/qv4irbuilder.cpp @@ -628,7 +628,8 @@ bool QV4IRBuilder::visit(AST::FieldMemberExpression *ast) case IR::Name::Property: if (baseName->type == IR::ObjectType && baseName->meta && baseName->property->isFinal()) { - QQmlPropertyCache *cache = m_engine->cache(baseName->meta); + const QMetaObject *meta = m_engine->metaObjectForType(baseName->property->propType); + QQmlPropertyCache *cache = m_engine->cache(meta); if (!cache) return false; @@ -640,9 +641,9 @@ bool QV4IRBuilder::visit(AST::FieldMemberExpression *ast) return false; // We don't know enough about this property } - IR::Type irType = irTypeFromVariantType(data->propType, m_engine, baseName->meta); + IR::Type irType = irTypeFromVariantType(data->propType, m_engine, meta); _expr.code = _block->SYMBOL(baseName, irType, name, - baseName->meta, data, line, column); + meta, data, line, column); } } break; diff --git a/tests/auto/qml/v4/tst_v4.cpp b/tests/auto/qml/v4/tst_v4.cpp index f8422ac..91a3226 100644 --- a/tests/auto/qml/v4/tst_v4.cpp +++ b/tests/auto/qml/v4/tst_v4.cpp @@ -252,7 +252,6 @@ void tst_v4::nestedObjectAccess() ResultObject *ro = qobject_cast(o); QVERIFY(ro != 0); - QEXPECT_FAIL("","QTBUG-24606", Continue); QCOMPARE(ro->result(), 37); delete o;