QmlJS: Fix infinite loop for objects that are attached to themselves.

This commit is contained in:
Christian Kamm
2011-03-11 10:18:42 +01:00
parent d3f798d3b0
commit 106513223d

View File

@@ -2114,9 +2114,11 @@ void CppQmlTypes::setPrototypes(QmlObjectValue *object)
FakeMetaObject::ConstPtr fmo = object->metaObject();
// resolve attached type
if (!fmo->attachedTypeName().isEmpty()) {
// don't do it if the attached type name is the object itself (happens for QDeclarativeKeysAttached)
if (!fmo->attachedTypeName().isEmpty()
&& fmo->className() != fmo->attachedTypeName()) {
QmlObjectValue *attachedObject = typeByCppName(fmo->attachedTypeName());
if (attachedObject)
if (attachedObject && attachedObject != object)
object->setAttachedType(attachedObject);
}