[PyKDE] Re: really wierd qthread + emit issue

Matt Chambers chambers at imageworks.com
Wed Nov 22 18:45:38 GMT 2006

Lukáš Lalinský wrote:
> Matt Chambers  wrote / napísal(a):
>> Using PyQt 4.0 and Qt 4.1.  I'm emitting a single from a QThread with a
>> single argument.   About 50% of the time when  I catch
>> the signal and execute the slot function, the argument is a QMutex
>> object, not the argument I emitted with the signal.
>> Here is my threads run() function.
> [...]
>> Notice I'm emitting the signal with a cuejob.CueJob object, but from the
>> slot, when I print the first argument, I get:
>> <PyQt4.QtCore.QMutex object at 0xf6b0b22c>
> There are two problems with the code:
> 1. Don't use "short-circuit" signals for communication between threads. The slot
> will be called from the same thread, not via the queued connection from the main
> thread, which is probably what you want. Use
> QtCore.SIGNAL("parsingComplete(PyObject*)") instead.
> 2. Keep references to the emit arguments, otherwise they will get deleted and
> replaced with a different objects that reuse the same memory block.
Fixing those two things worked thanks!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20061122/0a5bb28d/attachment.html

More information about the PyQt mailing list