Fixed an issue where repeatedly enabling and disabling auto collections could crash the application

This commit is contained in:
Leon Styhre 2023-10-18 17:49:39 +02:00
parent 78a4223b8e
commit c0a2f9f557

View file

@ -1351,11 +1351,14 @@ void CollectionSystemsManager::removeCollectionsFromDisplayedSystems()
// Remove all collection Systems.
for (auto sysIt = SystemData::sSystemVector.cbegin();
sysIt != SystemData::sSystemVector.cend();) {
if ((*sysIt)->isCollection())
if ((*sysIt)->isCollection()) {
(*sysIt)->getRootFolder()->setUpdateListCallback(nullptr);
sysIt = SystemData::sSystemVector.erase(sysIt);
else
}
else {
++sysIt;
}
}
// Remove all custom collections in bundle.
// This should not delete the objects from memory!