Skip to content

Commit

Permalink
Clone profile for immutability in IfcDerivedProfileDef
Browse files Browse the repository at this point in the history
  • Loading branch information
aothms committed Apr 11, 2024
1 parent 9e2645d commit 85887b6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/ifcgeom/mapping/IfcDerivedProfileDef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ using namespace ifcopenshell::geometry;

taxonomy::ptr mapping::map_impl(const IfcSchema::IfcDerivedProfileDef* inst) {
auto it = map(inst->ParentProfile());
if (it == nullptr) {
return nullptr;
}
// @todo we mutate it so we need to clone otherwise we alter the cached item.
it = taxonomy::item::ptr(it->clone_());
taxonomy::matrix4::ptr m = taxonomy::cast<taxonomy::matrix4>(map(inst->Operator()));
if (!taxonomy::cast<taxonomy::geom_item>(it)->matrix) {
// @todo should this not be initialized by default? matrix4 already has a 'lazy identity' mechanism.
Expand Down

0 comments on commit 85887b6

Please sign in to comment.