From 7df96408073a9b8ced5fd561826347e6d0798516 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Sat, 28 Jan 2023 14:21:45 +0100 Subject: [PATCH] #2704 properly propagate iterator destructor --- src/ifcgeom_schema_agnostic/IfcGeomIterator.h | 4 ++++ src/ifcgeom_schema_agnostic/IteratorImplementation.h | 1 + 2 files changed, 5 insertions(+) diff --git a/src/ifcgeom_schema_agnostic/IfcGeomIterator.h b/src/ifcgeom_schema_agnostic/IfcGeomIterator.h index 04437e58a4..4f45c108a1 100644 --- a/src/ifcgeom_schema_agnostic/IfcGeomIterator.h +++ b/src/ifcgeom_schema_agnostic/IfcGeomIterator.h @@ -107,6 +107,10 @@ namespace IfcGeom { } } + ~Iterator() { + delete implementation_; + } + bool initialize() { if (implementation_) { return implementation_->initialize(); diff --git a/src/ifcgeom_schema_agnostic/IteratorImplementation.h b/src/ifcgeom_schema_agnostic/IteratorImplementation.h index fc9ca78aeb..7879263264 100644 --- a/src/ifcgeom_schema_agnostic/IteratorImplementation.h +++ b/src/ifcgeom_schema_agnostic/IteratorImplementation.h @@ -73,6 +73,7 @@ namespace IfcGeom { virtual BRepElement* get_native() = 0; virtual const Element* get_object(int id) = 0; virtual IfcUtil::IfcBaseClass* create() = 0; + virtual ~IteratorImplementation() {} }; }