Fix bugs in mapping model update

This commit is contained in:
Ryan Huffman 2016-03-09 16:44:41 -08:00
parent 232bfc9061
commit 3467e06199

View file

@ -173,15 +173,24 @@ void AssetMappingModel::refresh() {
Q_ASSERT(fullPath == path); Q_ASSERT(fullPath == path);
} }
for (auto& path : existingPaths) {
Q_ASSERT(_pathToItemMap.contains(path)); // Remove folders from list
auto item = _pathToItemMap[path]; auto it = existingPaths.begin();
while (it != existingPaths.end()) {
auto item = _pathToItemMap[*it];
if (item->data(Qt::UserRole + 1).toBool()) { if (item->data(Qt::UserRole + 1).toBool()) {
continue; it = existingPaths.erase(it);
} else {
++it;
}
} }
for (auto& path : existingPaths) {
Q_ASSERT(_pathToItemMap.contains(path));
qDebug() << "removing existing: " << path; qDebug() << "removing existing: " << path;
auto item = _pathToItemMap[path];
while (item) { while (item) {
// During each iteration, delete item // During each iteration, delete item
QStandardItem* nextItem = nullptr; QStandardItem* nextItem = nullptr;