xc
xc copied to clipboard
Avoid segfault when accessing dangling Python objects
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
n3must be removed from the model, so the C++ counterpart of then3Python object is deleted. Then3Python object and the third item of thenode_listlist become dangling references. - Any attempt to access either
n3ornode_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: