How to delete custom defined widget classes in pyside2

218 views Asked by At

I am migrating a project from python27 to python37 so that I could switch from using PyQt to PySide. When refactoring my code, I am now unable to delete instances of my custom class that inherits from the QTreeWidgetItem

class CustomTreeItem(qtwidget.QTreeWidgetItem):

Originally, I was just doing sip.delete(CustomTreeItem object). However, after the migration I tried doing the same thing with shiboken2.delete(CustomTreeItem object) and received the error

Process finished with exit code -1073741819 (0xC0000005)

Thinking that the error was related to shiboken2, I tried other ways of deleting

assm_tree_widget.clear()

and

selections = assm_tree_widget.selectedItems()
for item in selections:
    index = assm_tree_widget.indexOfTopLevelItem(item)
    assm_tree_widget.takeTopLevelItem(index)

Both of these throw similar exit codes.

0

There are 0 answers