[PyKDE] Re: Auto-disconnection of signals broken?

Giovanni Bajo rasky at develer.com
Tue Mar 14 11:38:12 GMT 2006


Phil Thompson <phil at riverbankcomputing.co.uk> wrote:

>> Using PyQt snapshot-20051212 and SIP snapshot-20051212:
>>
>> ---------------------------------------------------------------
>> from qt import *
>>
>> app = QApplication([])
>>
>> o = QObject(None)
>> w = QWidget(None)
>>
>> QObject.connect(o, PYSIGNAL("FOO"), w.update)
>> o.emit(PYSIGNAL("FOO"), ())
>>
>> w.deleteLater()
>> o.emit(PYSIGNAL("FOO"), ())
>>
>> app.sendPostedEvents(w, QEvent.DeferredDelete)
>> o.emit(PYSIGNAL("FOO"), ())
>> ---------------------------------------------------------------
>> Traceback (most recent call last):
>>   File "D:\Work\caligola3d\src\pyqtbug9.py", line 17, in ?
>>     o.emit(PYSIGNAL("FOO"), ())
>> RuntimeError: underlying C/C++ object has been deleted
>>
>>
>> Shouldn't the signal be automatically disconnected when the widget dies?
>
> Should be fixed in tonight's SIP snapshot.

Phil, the testcase is indeed fixed, but not the original bug in my
application. I will try reducing a new testcase for the problem, but can you
have a double look at that part of the code to see if you can see any
remaining problem by code inspection? The symptom is the same as the
testcase above: a slot in a destroyed QWidget is called, but the connection
should have been automatically disconnected.
-- 
Giovanni Bajo




More information about the PyQt mailing list