erase enitty mapping upon deletion

This commit is contained in:
Thomas Krijnen
2021-01-21 13:24:18 +01:00
parent 73439e2114
commit 37fe54d247
+10
View File
@@ -1903,6 +1903,16 @@ void IfcFile::removeEntity(IfcUtil::IfcBaseClass* entity) {
break;
}
}
// This entity_file_map remains obviously flawed, but until we have proper lookup by value, or another mechanism,
// to prevent duplicate definitions with usage of add() we have to keep it. This might be a good moment to clear it.
for (auto it = entity_file_map.begin(); it != entity_file_map.end();) {
if (it->second == entity) {
it = entity_file_map.erase(it);
} else {
++it;
}
}
delete entity;
}