Skip to content

Commit 4008be9

Browse files
committed
issue #8291: Doxygen crash on Windows when INLINE_SIMPLE_STRUCTS=YES
1 parent 9c9958f commit 4008be9

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

src/doxygen.cpp

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1469,29 +1469,41 @@ static void processTagLessClasses(const ClassDef *rootCd,
14691469
}
14701470
}
14711471

1472-
static void findTagLessClasses(const ClassDef *cd)
1472+
static void findTagLessClasses(std::vector<ClassDefMutable*> &candidates,const ClassDef *cd)
14731473
{
14741474
for (const auto &icd : cd->getClasses())
14751475
{
14761476
if (icd->name().find("@")==-1) // process all non-anonymous inner classes
14771477
{
1478-
findTagLessClasses(icd);
1478+
findTagLessClasses(candidates,icd);
14791479
}
14801480
}
14811481

1482-
processTagLessClasses(cd,cd,toClassDefMutable(cd),"",0); // process tag less inner struct/classes (if any)
1482+
ClassDefMutable *cdm = toClassDefMutable(cd);
1483+
if (cdm)
1484+
{
1485+
candidates.push_back(cdm);
1486+
}
14831487
}
14841488

14851489
static void findTagLessClasses()
14861490
{
1491+
std::vector<ClassDefMutable *> candidates;
14871492
for (const auto &cd : *Doxygen::classLinkedMap)
14881493
{
14891494
Definition *scope = cd->getOuterScope();
14901495
if (scope && scope->definitionType()!=Definition::TypeClass) // that is not nested
14911496
{
1492-
findTagLessClasses(cd.get());
1497+
findTagLessClasses(candidates,cd.get());
14931498
}
14941499
}
1500+
1501+
// since processTagLessClasses is potentially adding classes to Doxygen::classLinkedMap
1502+
// we need to call it outside of the loop above, otherwise the iterator gets invalidated!
1503+
for (auto &cd : candidates)
1504+
{
1505+
processTagLessClasses(cd,cd,cd,"",0); // process tag less inner struct/classes
1506+
}
14951507
}
14961508

14971509

0 commit comments

Comments
 (0)