mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 02:07:36 +00:00
Do not free the IFC file if it has not been constructed by the iterator
This commit is contained in:
@@ -459,16 +459,20 @@ namespace IfcGeom {
|
|||||||
kernel.setValue(IfcGeom::Kernel::GV_MAX_FACES_TO_SEW, settings.sew_shells() ? 1000 : -1);
|
kernel.setValue(IfcGeom::Kernel::GV_MAX_FACES_TO_SEW, settings.sew_shells() ? 1000 : -1);
|
||||||
kernel.setValue(IfcGeom::Kernel::GV_DIMENSIONALITY, (settings.include_curves() ? (settings.exclude_solids_and_surfaces() ? -1. : 0.) : +1.));
|
kernel.setValue(IfcGeom::Kernel::GV_DIMENSIONALITY, (settings.include_curves() ? (settings.exclude_solids_and_surfaces() ? -1. : 0.) : +1.));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool owns_ifc_file;
|
||||||
public:
|
public:
|
||||||
Iterator(const IteratorSettings& settings, IfcParse::IfcFile* file)
|
Iterator(const IteratorSettings& settings, IfcParse::IfcFile* file)
|
||||||
: settings(settings)
|
: settings(settings)
|
||||||
, ifc_file(file)
|
, ifc_file(file)
|
||||||
|
, owns_ifc_file(false)
|
||||||
{
|
{
|
||||||
_initialize();
|
_initialize();
|
||||||
}
|
}
|
||||||
Iterator(const IteratorSettings& settings, const std::string& filename)
|
Iterator(const IteratorSettings& settings, const std::string& filename)
|
||||||
: settings(settings)
|
: settings(settings)
|
||||||
, ifc_file(new IfcParse::IfcFile)
|
, ifc_file(new IfcParse::IfcFile)
|
||||||
|
, owns_ifc_file(true)
|
||||||
{
|
{
|
||||||
ifc_file->Init(filename);
|
ifc_file->Init(filename);
|
||||||
_initialize();
|
_initialize();
|
||||||
@@ -476,6 +480,7 @@ namespace IfcGeom {
|
|||||||
Iterator(const IteratorSettings& settings, void* data, int length)
|
Iterator(const IteratorSettings& settings, void* data, int length)
|
||||||
: settings(settings)
|
: settings(settings)
|
||||||
, ifc_file(new IfcParse::IfcFile)
|
, ifc_file(new IfcParse::IfcFile)
|
||||||
|
, owns_ifc_file(true)
|
||||||
{
|
{
|
||||||
ifc_file->Init(data, length);
|
ifc_file->Init(data, length);
|
||||||
_initialize();
|
_initialize();
|
||||||
@@ -483,14 +488,16 @@ namespace IfcGeom {
|
|||||||
Iterator(const IteratorSettings& settings, std::istream& filestream, int length)
|
Iterator(const IteratorSettings& settings, std::istream& filestream, int length)
|
||||||
: settings(settings)
|
: settings(settings)
|
||||||
, ifc_file(new IfcParse::IfcFile)
|
, ifc_file(new IfcParse::IfcFile)
|
||||||
|
, owns_ifc_file(true)
|
||||||
{
|
{
|
||||||
ifc_file->Init(filestream, length);
|
ifc_file->Init(filestream, length);
|
||||||
_initialize();
|
_initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
~Iterator() {
|
~Iterator() {
|
||||||
// TODO: Correctly implement destructor for IfcFile
|
if (owns_ifc_file) {
|
||||||
delete ifc_file;
|
delete ifc_file;
|
||||||
|
}
|
||||||
|
|
||||||
delete current_triangulation;
|
delete current_triangulation;
|
||||||
current_triangulation = 0;
|
current_triangulation = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user