[PyKDE] PyQt4, inter-thread signals and Python types

Phil Thompson phil at riverbankcomputing.co.uk
Tue Aug 1 13:53:28 BST 2006


On Tuesday 01 August 2006 1:24 pm, Lukáš Lalinský wrote:
> Hi,
>
> I'm trying to use signals/slots inter-thread communication, but I have
> problems with using Python objects. First I tried to use "short-circuit"
> signals, but I was getting lots of exceptions from garbage collector. I
> guess the queued connections are just not implemented for this type of
> signals, which is understandable (perhaps QObject.connect could raise an
> exception when trying to connect "short-circuit" signal with a
> QueuedConnection?).
>
> Then I tried QtCore.SIGNAL("someSignal(PyObject *)"), but this just crashes
> Python if I use it with a local variable -- it doesn't increment the
> reference count. If I keep the reference to the object myself it works
> fine. Is there some way to tell PyQt to increment the reference count when
> calling QObject.connect with a Python object and decrease it again after
> calling all slots?

No because, for a queued connection, PyQt wouldn't know when all the slots had 
been called.

Phil




More information about the PyQt mailing list