When I use this code to remove an item from my tree, The item is removed but the delegate keeps running:
# I do this from inside an item that has a reference to its tree-owner....
index = self.tree.indexFromItem(self)
self.tree.model().removeRow(index.row(), index.parent())
Is there some reference I have to mess with to get it to properly give up on the item’s paint?
If I clear the tree and rebuild it, it works fine, but I’m trying to do this more directly.
Some more detail….
My GUI is for a 3D application. The tree item accesses a node in the 3D app’s API. I am removing the item when the node in the 3D application is deleted (trying to sync my tree to the scene). What I see is that the item is removed from the tree successfully, but an error is raised because my reference to the 3D app node is bad. If I click around the error repeats over and over. I’m not sure if it is failing each time or if the first error is breaking the GUI causing the repeat error, as if it interrupted cleanup.
I tried setting all of my item’s members/attributes to None, but I’m not sure if that actually kills a reference, or when the garbage collector will do its job, etc.
I have to assume this is just an async update where the remove row call is beating out the delegate for the update. I added protection to silence the error and everything seems to work fine.