Commit 44075e0d authored by Thomas Hartmann's avatar Thomas Hartmann

QmlDesigner: crash fix

There might be cycles in the prototype chain.
In this case the meta info is invalid.

setupPrototypes() now flags the meta info as
invalid in this case.

If not we risk a stack overflow when running the
parent chain (Which might have a cycle then.)

Task-number: QTCREATORBUG-8399
Change-Id: Ie9f6bfc39cdfd1365463a70e76081d53df33da7f
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@digia.com>
parent 15d93a15
......@@ -477,8 +477,8 @@ NodeMetaInfoPrivate::NodeMetaInfoPrivate(Model *model, QString type, int maj, in
setupPropertyInfo(getTypes(objectValue, context()));
setupLocalPropertyInfo(getTypes(objectValue, context(), true));
m_defaultPropertyName = objectValue->defaultPropertyName();
setupPrototypes();
m_isValid = true;
setupPrototypes();
} else {
const ObjectValue *objectValue = getObjectValue();
if (objectValue) {
......@@ -499,8 +499,8 @@ NodeMetaInfoPrivate::NodeMetaInfoPrivate(Model *model, QString type, int maj, in
setupPropertyInfo(getTypes(objectValue, context()));
setupLocalPropertyInfo(getTypes(objectValue, context(), true));
m_defaultPropertyName = context()->defaultPropertyName(objectValue);
setupPrototypes();
m_isValid = true;
setupPrototypes();
}
}
}
......@@ -911,10 +911,22 @@ QString NodeMetaInfoPrivate::propertyType(const QString &propertyName) const
void NodeMetaInfoPrivate::setupPrototypes()
{
QList<const ObjectValue *> objects;
const ObjectValue *ov;
if (m_isFileComponent)
objects = PrototypeIterator(getObjectValue(), context()).all();
ov = getObjectValue();
else
objects = PrototypeIterator(getCppComponentValue(), context()).all();
ov = getCppComponentValue();
PrototypeIterator prototypeIterator(ov, context());
objects = prototypeIterator.all();
if (prototypeIterator.error() != PrototypeIterator::NoError) {
m_isValid = false;
return;
}
foreach (const ObjectValue *ov, objects) {
TypeDescription description;
......
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