Thank you for the suggestion Alexis.  I tried to connect this signal as 
follows but never saw a message before the error happened.
along with other 
connections....self.ui.listBlockTypes.destroyed.connect(self.listSource_Destroyed)

another method in the application class...def listSource_Destroyed(self, 
SomeObject): print('Application : listSource_Destroyed')
The list widget is arranged in QtDesigner and the UI file is loaded using:    
self.ui =  QtUiTools.QUiLoader().load()
 If I were creating the widget in code then I understand how I might be able to 
let it fall out of scope and be destroyed.  This is so frustrating.
Henry

    On Monday, March 27, 2023 at 03:51:01 AM MDT, Alexis Jeandet 
<alexis.jean...@member.fsf.org> wrote:  
 
 Hello Henry,
I usually get this error when I forget to keep an active reference on one 
object from Python.Then since QListWidget inherits QObject, you can connect 
something to its "destroyed" signal to see when it gets 
deleted.https://doc.qt.io/qt-6/qobject.html#destroyed
Alexis.On Mon, 2023-03-27 at 03:26 +0000, henry.wede--- via PySide wrote:
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
_______________________________________________
PySide mailing list
PySide@qt-project.org
https://lists.qt-project.org/listinfo/pyside


  
_______________________________________________
PySide mailing list
PySide@qt-project.org
https://lists.qt-project.org/listinfo/pyside

Reply via email to