Permalink
Browse files

Fix infinite recursion introduced in Qt 4.8.0

I hope this does not cause any other problems...
  • Loading branch information...
mkottman committed Feb 5, 2012
1 parent 88bec75 commit 903dd3948d8d11074d08c2f2b31cc41bb5462e6c
Showing with 10 additions and 4 deletions.
  1. +9 −3 cpptoxml/parser/codemodel.cpp
  2. +1 −1 cpptoxml/parser/codemodel.h
@@ -151,8 +151,14 @@ TypeInfo TypeInfo::resolveType (TypeInfo const &__type, CodeModelItem __scope)
}
if (TypeAliasModelItem __alias = model_dynamic_cast<TypeAliasModelItem> (__item))
- if (__alias->type().qualifiedName() != otherType.qualifiedName())
- return resolveType (TypeInfo::combine (__alias->type (), otherType), __scope);
+ if (__alias->type().qualifiedName() != otherType.qualifiedName()) {
+ const TypeInfo &aliasType = __alias->type();
+ // prevent infinite recursion introduced in Qt 4.8.0
+ if (__type == aliasType)
+ return __type;
+ TypeInfo combined = combine(aliasType, otherType);
+ return resolveType(combined, __scope);
+ }
return otherType;
}
@@ -197,7 +203,7 @@ QString TypeInfo::toString() const
return tmp;
}
-bool TypeInfo::operator==(const TypeInfo &other)
+bool TypeInfo::operator==(const TypeInfo &other) const
{
if (arrayElements().count() != other.arrayElements().count())
return false;
@@ -146,7 +146,7 @@ class TypeInfo
void setArguments(const QList<TypeInfo> &arguments);
void addArgument(const TypeInfo &arg) { m_arguments.append(arg); }
- bool operator==(const TypeInfo &other);
+ bool operator==(const TypeInfo &other) const;
bool operator!=(const TypeInfo &other) { return !(*this==other); }
// ### arrays and templates??

0 comments on commit 903dd39

Please sign in to comment.