[PyKDE] pysignals and Py_DECREF

Patrick Stinson patrickkidd.lists at gmail.com
Thu May 25 21:42:24 BST 2006


On 5/25/06, Phil Thompson <phil at riverbankcomputing.co.uk> wrote:
> On Monday 22 May 2006 3:38 am, Patrick Stinson wrote:
> > 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.
>
> The error message is due a SIP bug - fixed in tonight's snapshot.
>
> > 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?
>
> It has never been true precisely to avoid having to manually disconnect
> everything.

isn't that a relief...

>
> > Any other
> > relavent commentary regarding references, pysignals, and
> > QObject::disconnect?
>
> Phil
>


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




More information about the PyQt mailing list