summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTannin <devnull@localhost>2015-08-12 21:50:06 +0200
committerTannin <devnull@localhost>2015-08-12 21:50:06 +0200
commit69a8a40b9993b791d99097549b13dee2fad0f222 (patch)
tree7d8a65de943c0a35457181e4bf3d9e6476d5481b /src
parent229161565ec6657be1d598c5f580a071ada72c6e (diff)
bugfix: categories that reference each other in a cycle could send MO into an endless loop
Diffstat (limited to 'src')
-rw-r--r--src/mainwindow.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 422207bb..c726991c 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -2113,9 +2113,14 @@ void MainWindow::refreshFilters()
ModInfo::Ptr modInfo = ModInfo::getByIndex(modIdx);
for (int categoryID : modInfo->getCategories()) {
int currentID = categoryID;
+ std::set<int> cycleTest;
// also add parents so they show up in the tree
while (currentID != 0) {
categoriesUsed.insert(currentID);
+ if (!cycleTest.insert(currentID).second) {
+ qWarning("cycle in categories: %s", qPrintable(SetJoin(cycleTest, ", ")));
+ break;
+ }
currentID = m_CategoryFactory.getParentID(m_CategoryFactory.getCategoryIndex(currentID));
}
}