From 9d437b5bc34e677d7c548e225a5573fa46b427d2 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Tue, 25 Nov 2025 09:19:18 +0100 Subject: [PATCH] Mark simple type instance file ownership #7226 --- src/ifcparse/IfcParse.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ifcparse/IfcParse.cpp b/src/ifcparse/IfcParse.cpp index 3a7c373a7d..f0f880b7d6 100644 --- a/src/ifcparse/IfcParse.cpp +++ b/src/ifcparse/IfcParse.cpp @@ -1607,6 +1607,11 @@ void IfcParse::impl::in_memory_file_storage::read_from_stream(IfcParse::FileRead // Move the storage of simple type instances so that they are retained during the lifetime of the file read_simple_type_instances = streamer.stealInstances(); + // Set file ownership on simple type instances, so that when adding them to other files, proper copies are created + for (auto& inst : read_simple_type_instances) { + inst->file_ = file; + } + Logger::Status("\rDone scanning file "); delete tokens;