Commit 912a1b95 authored by Erik Verbruggen's avatar Erik Verbruggen
Browse files

Fixed crash when putting a second root item into a QML file.

parent 878e096e
......@@ -49,6 +49,7 @@ void Link::scopeChainAt(Document::Ptr doc, const QList<Node *> &astPath)
_context->setLookupMode(Context::QmlLookup);
scopeChain.qmlComponentScope.clear();
componentScopes.insert(doc.data(), &scopeChain.qmlComponentScope);
makeComponentChain(doc, &scopeChain.qmlComponentScope, &componentScopes);
if (const ObjectValue *typeEnvironment = _context->typeEnvironment(doc.data()))
......@@ -93,7 +94,7 @@ void Link::makeComponentChain(
continue;
if (otherDoc->bind()->usesQmlPrototype(bind->rootObjectValue(), _context)) {
if (components->contains(otherDoc.data())) {
target->instantiatingComponents += components->value(otherDoc.data());
// target->instantiatingComponents += components->value(otherDoc.data());
} else {
ScopeChain::QmlComponentChain *component = new ScopeChain::QmlComponentChain;
components->insert(otherDoc.data(), component);
......
......@@ -69,6 +69,8 @@ void ScopeBuilder::setQmlScopeObject(Node *node)
const ObjectValue *scopeObject = _doc->bind()->findQmlObject(node);
if (scopeObject) {
scopeChain.qmlScopeObjects += scopeObject;
} else {
return; // Probably syntax errors, where we're working with a "recovered" AST.
}
#ifndef NO_DECLARATIVE_BACKEND
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment