[PySide] Internal C++ object (PySide2.QtWidgets.QListWidget) already deleted

henry.wede at yahoo.com henry.wede at yahoo.com
Mon Mar 27 05:26:36 CEST 2023


Hello all,
I've spent hours trying to figure out a solution to this and I just don't understand what is happening.
The GUI has a QListWidget that contains some objects that subclass QListWidgetItem.  The user can drag these onto a QGraphicsScene and then all kinds of wonderful stuff happens.  And it always works the first time that and object is dropped.  The second time it reports that "Internal C++ object (PySide2.QtWidgets.QListWidget) already deleted".  Not an object in the list, but the list itself!  
It gets even stranger because I added print statements at the start and end of the GraphicsScene drop event.  The first time an item is dropped both print statement print the object as expected.  Specifically, print(self.ui.listBlockTypes) displays <PySide2.QtWidgets.QListWidget(0x187ec2beac0, name="listBlockTypes") at 0x00000187ECDCE040>  so the code in the drop event shouldn't be doing any damage.  
But after the first drop, when I click on an item in the ListWidget (which also has the same print statement) then it reports the error.  How can that be?  It seems that the last line of code that is run in the drop event prints that the ListWidget exists and then the very next line that runs in the ListWidget currentItemChanged event prints an error.
Does anyone have a suggestion?
By the way, I know it would be easier if I could trim down a small program that would display the problem but this is fairly sizable program and that sounds like many hours of work.  
Thanks for your help,
Henry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20230327/ff54546a/attachment.htm>


More information about the PySide mailing list