Address segfault #7215 #7185

This commit is contained in:
Thomas Krijnen
2025-10-08 14:17:47 +02:00
parent 4ab2664529
commit e15f222a19
4 changed files with 15 additions and 8 deletions
+4 -1
View File
@@ -725,7 +725,7 @@ void IfcParse::impl::in_memory_file_storage::load(unsigned entity_instance_name,
// the 2nd pass.
load(entity_instance_name, entity, ps, attribute_index == -1 ? (int)attribute_index_within_data : attribute_index);
auto* simple_type_instance = (schema ? schema : file->schema())->instantiate(decl, ps.construct(entity_instance_name, *references_to_resolve, decl, boost::none, attribute_index == -1 ? (int)attribute_index_within_data : attribute_index));
read_simple_type_instances.push_back(simple_type_instance);
read_simple_type_instances.emplace_back(simple_type_instance);
//@todo decide addEntity(((IfcUtil::IfcBaseClass*)*entity));
context.push(simple_type_instance);
simple_type_instance->file_ = file;
@@ -1651,6 +1651,9 @@ void IfcParse::impl::in_memory_file_storage::read_from_stream(IfcParse::IfcSpfSt
good_ = streamer.status();
byref_excl_ = streamer.inverses();
// Move the storage of simple type instances so that they are retained during the lifetime of the file
read_simple_type_instances = streamer.steal_instances();
Logger::Status("\rDone scanning file ");