diff options
4 files changed, 23 insertions, 0 deletions
diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index e642a67..abde4ad 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -622,6 +622,7 @@ bool QDeclarativeCompiler::compile(QDeclarativeEngine *engine, out->dumpInstructions(); if (compilerStatDump()) dumpStats(); + Q_ASSERT(out->rootPropertyCache); } else { reset(out); } @@ -1218,6 +1219,11 @@ void QDeclarativeCompiler::genComponent(QDeclarativeParser::Object *obj) id.setId.index = obj->idIndex; output->bytecode << id; } + + if (obj == unitRoot) { + output->rootPropertyCache = output->types[obj->type].createPropertyCache(engine); + output->rootPropertyCache->addref(); + } } bool QDeclarativeCompiler::buildComponent(QDeclarativeParser::Object *obj, diff --git a/tests/auto/declarative/qdeclarativelanguage/data/NestedComponentRoot.qml b/tests/auto/declarative/qdeclarativelanguage/data/NestedComponentRoot.qml new file mode 100644 index 0000000..785a27d --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/NestedComponentRoot.qml @@ -0,0 +1,6 @@ +import QtQuick 1.0 + +Component { + Item { + } +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/nestedComponentRoots.qml b/tests/auto/declarative/qdeclarativelanguage/data/nestedComponentRoots.qml new file mode 100644 index 0000000..361bcbc --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/nestedComponentRoots.qml @@ -0,0 +1,4 @@ +import QtQuick 1.0 + +NestedComponentRoot { +} diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index d6e6a4a..7f186b3 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -135,6 +135,7 @@ private slots: void reservedWords_data(); void reservedWords(); void inlineAssignmentsOverrideBindings(); + void nestedComponentRoots(); void basicRemote_data(); void basicRemote(); @@ -1425,6 +1426,12 @@ void tst_qdeclarativelanguage::inlineAssignmentsOverrideBindings() delete o; } +// QTBUG-19354 +void tst_qdeclarativelanguage::nestedComponentRoots() +{ + QDeclarativeComponent component(&engine, TEST_FILE("nestedComponentRoots.qml")); +} + // Import tests (QT-558) void tst_qdeclarativelanguage::importsBuiltin_data() { |