Does adding a node to a scene give ownership of the node to the scene?
i.e. will the node be deallocated cleanly when the scene is destroyed?
I am talking about adding a node via vtkMRMLScene::AddNode
Does adding a node to a scene give ownership of the node to the scene?
i.e. will the node be deallocated cleanly when the scene is destroyed?
I am talking about adding a node via vtkMRMLScene::AddNode
It was pointed to vtkMRMLScene::AddNewNodeByClass
as the easy way to add a new node to a scene without worrying about memory issues. This worked for me. I still don’t know the answer to my question, but my problem is solved.
All VTK objects have internal reference counting, so they can be always readily shared between multiple owners. The object automatically gets deleted when no other object references it anymore.
When you set a VTK object A into VTK object B then most of the time B will just add one more reference to B.