Keep file_ as nullptr to not bypass addEntity() #7264

This commit is contained in:
Thomas Krijnen
2025-10-20 10:33:09 +02:00
committed by GitHub
parent f05b0d946d
commit 34f4aa430a
+2 -2
View File
@@ -748,7 +748,7 @@ std::optional<std::tuple<size_t, const IfcParse::declaration*, IfcEntityInstance
IfcUtil::IfcBaseClass* IfcParse::impl::rocks_db_file_storage::create(const IfcParse::declaration* decl) { IfcUtil::IfcBaseClass* IfcParse::impl::rocks_db_file_storage::create(const IfcParse::declaration* decl) {
if (decl->as_entity() || decl->as_type_declaration()) { if (decl->as_entity() || decl->as_type_declaration()) {
auto* inst = file->schema()->instantiate(decl, rocks_db_attribute_storage{}); auto* inst = file->schema()->instantiate(decl, rocks_db_attribute_storage{});
inst->file_ = file; inst->file_ = nullptr;
return file->addEntity(inst); return file->addEntity(inst);
} else { } else {
throw std::runtime_error("Requires and entity or type declaration"); throw std::runtime_error("Requires and entity or type declaration");
@@ -764,6 +764,6 @@ IfcUtil::IfcBaseClass* IfcParse::impl::in_memory_file_storage::create(const IfcP
} else { } else {
throw std::runtime_error("Requires and entity or type declaration"); throw std::runtime_error("Requires and entity or type declaration");
} }
inst->file_ = file; inst->file_ = nullptr;
return file->addEntity(inst); return file->addEntity(inst);
} }