mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-23 15:06:25 +00:00
fix leaking as_compound() calls
This commit is contained in:
committed by
Thomas Krijnen
parent
c9eb345491
commit
15a31074e8
@@ -254,7 +254,7 @@ IfcGeom::ConversionResultShape* IfcGeom::Representation::BRep::as_compound(bool
|
|||||||
builder.Add(compound, moved_shape);
|
builder.Add(compound, moved_shape);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ifcopenshell::geometry::OpenCascadeShape(compound);
|
return new ifcopenshell::geometry::OpenCascadeShape(std::move(compound));
|
||||||
#else
|
#else
|
||||||
throw std::runtime_error("Not available without Open Cascade");
|
throw std::runtime_error("Not available without Open Cascade");
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1365,8 +1365,10 @@ namespace IfcGeom {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::vector<T> select(const IfcGeom::BRepElement* elem, bool completely_within = false, double extend = -1.e-5) const {
|
std::vector<T> select(const IfcGeom::BRepElement* elem, bool completely_within = false, double extend = -1.e-5) const {
|
||||||
auto shp = elem->geometry().as_compound();
|
auto shp = (ifcopenshell::geometry::OpenCascadeShape*)elem->geometry().as_compound();
|
||||||
auto compound = ((ifcopenshell::geometry::OpenCascadeShape*)shp)->shape();
|
TopoDS_Shape compound(std::move((ifcopenshell::geometry::OpenCascadeShape*)shp)->shape()));
|
||||||
|
delete shp;
|
||||||
|
|
||||||
const auto& m = elem->transformation().data()->ccomponents();
|
const auto& m = elem->transformation().data()->ccomponents();
|
||||||
gp_Trsf tr;
|
gp_Trsf tr;
|
||||||
tr.SetValues(
|
tr.SetValues(
|
||||||
@@ -1956,8 +1958,9 @@ namespace IfcGeom {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto compound_generic = elem->geometry().as_compound();
|
auto compound_generic = (ifcopenshell::geometry::OpenCascadeShape*)elem->geometry().as_compound();
|
||||||
auto compound = ((ifcopenshell::geometry::OpenCascadeShape*)compound_generic)->shape();
|
TopoDS_Shape compound(std::move(compound_generic->shape()));
|
||||||
|
delete compound_generic;
|
||||||
|
|
||||||
const auto& m = elem->transformation().data()->ccomponents();
|
const auto& m = elem->transformation().data()->ccomponents();
|
||||||
gp_Trsf tr;
|
gp_Trsf tr;
|
||||||
|
|||||||
@@ -46,6 +46,8 @@ namespace ifcopenshell {
|
|||||||
public:
|
public:
|
||||||
OpenCascadeShape(const TopoDS_Shape& shape)
|
OpenCascadeShape(const TopoDS_Shape& shape)
|
||||||
: shape_(shape) {}
|
: shape_(shape) {}
|
||||||
|
OpenCascadeShape(TopoDS_Shape&& shape)
|
||||||
|
: shape_(std::move(shape)) {}
|
||||||
|
|
||||||
const TopoDS_Shape& shape() const { return shape_; }
|
const TopoDS_Shape& shape() const { return shape_; }
|
||||||
operator const TopoDS_Shape& () { return shape_; }
|
operator const TopoDS_Shape& () { return shape_; }
|
||||||
|
|||||||
Reference in New Issue
Block a user