I don't really understand this, but I get a crash. Example code:
import ifcopenshell
f = ifcopenshell.file()
c = f.createIfcGeometricRepresentationContext()
print("1", c.HasSubContexts)
sc = f.create_entity("IfcGeometricRepresentationSubContext", **{"ParentContext": c})
print("2", c.HasSubContexts)
sc2 = f.create_entity("IfcGeometricRepresentationSubContext", **{"ParentContext": c})
print("3", c.HasSubContexts) # If I comment this line out, no segfault
f.remove(sc)
f.remove(sc2)
print("4", c.HasSubContexts)
This results in:
1 ()
2 (#2=IfcGeometricRepresentationSubContext($,$,*,*,*,*,#1,$,$,$),)
3 (#2=IfcGeometricRepresentationSubContext($,$,*,*,*,*,#1,$,$,$), #3=IfcGeometricRepresentationSubContext($,$,*,*,*,*,#1,$,$,$))
[1] 4518 segmentation fault python test.py
If I comment out print("3", c.HasSubContexts), no segfault occurs:
1 ()
2 (#2=IfcGeometricRepresentationSubContext($,$,*,*,*,*,#1,$,$,$),)
4 ()
I don't really understand this, but I get a crash. Example code:
This results in:
If I comment out
print("3", c.HasSubContexts), no segfault occurs: