aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/declarative/qml/qdeclarativecompiler.cpp6
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/NestedComponentRoot.qml6
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/nestedComponentRoots.qml4
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp7
4 files changed, 23 insertions, 0 deletions
diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp
index 72010c0ef2..43bb58c88a 100644
--- a/src/declarative/qml/qdeclarativecompiler.cpp
+++ b/src/declarative/qml/qdeclarativecompiler.cpp
@@ -650,6 +650,7 @@ bool QDeclarativeCompiler::compile(QDeclarativeEngine *engine,
out->dumpInstructions();
if (compilerStatDump())
dumpStats();
+ Q_ASSERT(out->rootPropertyCache);
} else {
reset(out);
}
@@ -1230,6 +1231,11 @@ void QDeclarativeCompiler::genComponent(QDeclarativeParser::Object *obj)
id.setId.index = obj->idIndex;
output->addInstruction(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 0000000000..785a27dd79
--- /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 0000000000..361bcbcb56
--- /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 132c947d93..3c6ce9da6d 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();
@@ -1428,6 +1429,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()
{