mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-09 13:52:23 +00:00
Defer deletion so that traversal still works
This commit is contained in:
@@ -2022,6 +2022,7 @@ void IfcFile::removeEntity(const express::Base& entity) {
|
|||||||
batch_deletion_ids_.push_back(id);
|
batch_deletion_ids_.push_back(id);
|
||||||
} else {
|
} else {
|
||||||
process_deletion_(entity);
|
process_deletion_(entity);
|
||||||
|
byid_.erase(entity.id());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2112,9 +2113,6 @@ void IfcFile::process_deletion_(const express::Base& entity) {
|
|||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// This now frees the shared_ptr
|
|
||||||
byid_.erase(entity.id());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IfcParse::impl::in_memory_file_storage::process_deletion_inverse(const express::Base& entity) {
|
void IfcParse::impl::in_memory_file_storage::process_deletion_inverse(const express::Base& entity) {
|
||||||
@@ -2613,6 +2611,10 @@ void IfcParse::IfcFile::unbatch() {
|
|||||||
for (auto& id : batch_deletion_ids_) {
|
for (auto& id : batch_deletion_ids_) {
|
||||||
process_deletion_(instance_by_id(id));
|
process_deletion_(instance_by_id(id));
|
||||||
}
|
}
|
||||||
|
// keep in memory until all deletions are processed
|
||||||
|
for (auto& id : batch_deletion_ids_) {
|
||||||
|
byid_.erase(id);
|
||||||
|
}
|
||||||
batch_mode_ = false;
|
batch_mode_ = false;
|
||||||
batch_deletion_ids_.clear();
|
batch_deletion_ids_.clear();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user