[PyKDE] pysignals and Py_DECREF

Patrick Stinson patrickkidd.lists at gmail.com
Mon May 22 03:38:46 BST 2006


I am trying to disconnect all of the signals that I connected to a
QObject in order to ensure that it is deleted. The following program
prints "Object::disconnect: No such signal QObject::bleh(QObject*)" if
I uncomment the disconnect line, but also deletes the object when it
is dereferenced.

from PyQt4.QtCore import *

class O(QObject):
    def __init__(self):
        QObject.__init__(self)
    def __del__(self):
        print '__del__'

def slot(o):
    print o

o = O()
QObject.connect(o, SIGNAL('bleh(QObject *)'), slot)
#QObject.disconnect(o, SIGNAL('bleh(QObject *)'), slot)
o = None
print 'here'


I am posting this because I realized that I have no idea how
python-defined signals act anymore. I thought that if I connected the
signal the reference count was incremented, and I had to disconect it
if I wanted to delete the QObject. is this still true? Any other
relavent commentary regarding references, pysignals, and
QObject::disconnect?

-- 
Patrick Kidd Stinson
http://www.patrickkidd.com/
http://pkaudio.sourceforge.net/
http://pksampler.sourceforge.net/




More information about the PyQt mailing list