From 69a8a40b9993b791d99097549b13dee2fad0f222 Mon Sep 17 00:00:00 2001 From: Tannin Date: Wed, 12 Aug 2015 21:50:06 +0200 Subject: bugfix: categories that reference each other in a cycle could send MO into an endless loop --- src/mainwindow.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/mainwindow.cpp') 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 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)); } } -- cgit v1.3.1