Skip to content

Commit 6d4044a

Browse files
author
Dimitri van Heesch
committed
Fix potential crash when reading tag file which contained nested java classes using generics
Also fixed a parse error when reading a tag file with a Java-style enum
1 parent 745955f commit 6d4044a

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

src/doxygen.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,9 +1037,16 @@ static Definition *buildScopeFromQualifiedName(const QCString name,
10371037
else // scope is a namespace
10381038
{
10391039
}
1040-
// make the parent/child scope relation
1041-
prevScope->addInnerCompound(innerScope);
1042-
innerScope->setOuterScope(prevScope);
1040+
if (innerScope)
1041+
{
1042+
// make the parent/child scope relation
1043+
prevScope->addInnerCompound(innerScope);
1044+
innerScope->setOuterScope(prevScope);
1045+
}
1046+
else // current scope is a class, so return only the namespace part...
1047+
{
1048+
return prevScope;
1049+
}
10431050
// proceed to the next scope fragment
10441051
p=idx+l+2;
10451052
prevScope=innerScope;

src/tagreader.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class TagMemberInfo
9595
class TagClassInfo
9696
{
9797
public:
98-
enum Kind { Class, Struct, Union, Interface, Exception, Protocol, Category };
98+
enum Kind { Class, Struct, Union, Interface, Exception, Protocol, Category, Enum };
9999
TagClassInfo() { bases=0, templateArguments=0; members.setAutoDelete(TRUE); isObjC=FALSE; }
100100
~TagClassInfo() { delete bases; delete templateArguments; }
101101
QCString name;
@@ -301,6 +301,12 @@ class TagFileParser : public QXmlDefaultHandler
301301
m_curClass->kind = TagClassInfo::Interface;
302302
m_state = InClass;
303303
}
304+
else if (kind=="enum")
305+
{
306+
m_curClass = new TagClassInfo;
307+
m_curClass->kind = TagClassInfo::Enum;
308+
m_state = InClass;
309+
}
304310
else if (kind=="exception")
305311
{
306312
m_curClass = new TagClassInfo;
@@ -1286,6 +1292,7 @@ void TagFileParser::buildLists(Entry *root)
12861292
case TagClassInfo::Struct: ce->spec = Entry::Struct; break;
12871293
case TagClassInfo::Union: ce->spec = Entry::Union; break;
12881294
case TagClassInfo::Interface: ce->spec = Entry::Interface; break;
1295+
case TagClassInfo::Enum: ce->spec = Entry::Enum; break;
12891296
case TagClassInfo::Exception: ce->spec = Entry::Exception; break;
12901297
case TagClassInfo::Protocol: ce->spec = Entry::Protocol; break;
12911298
case TagClassInfo::Category: ce->spec = Entry::Category; break;

0 commit comments

Comments
 (0)