xc icon indicating copy to clipboard operation
xc copied to clipboard

Avoid segfault when accessing dangling Python objects

Open lcpt opened this issue 8 months ago • 0 comments

The problem goes as follows:

  • You put some XC nodes or elements or anything like that in a Python list node_list= [n1, n2, n3, n4]
  • For whatever reason, the node n3 must be removed from the model, so the C++ counterpart of the n3 Python object is deleted. The n3 Python object and the third item of the node_list list become dangling references.
  • Any attempt to access either n3 or node_list[2] results in a segmentation fault condition and the program crashes.

Maybe there is a way of informing boost.python about the deletion of the C++ objects, so n3 and node_list[2] can return None.

To look into:

lcpt avatar Mar 17 '25 14:03 lcpt