[PyKDE] Re: Threading problem with PyQt4 and Macosx

Michael Guntsche mike at it-loops.com
Sat Feb 24 19:58:55 GMT 2007


On Feb 24, 2007, at 10:28, Phil Thompson wrote:

> In the meantime you could try changing PyQt's configure.py (in
> set_sip_flags()) so that it invokes sip with the -g flag.
>

I did some more tests and noticed something weird I do not quite  
understand.
I once again took my trusty test script and created two different  
versions.

Version 1 (old version):

self.connect(self, QtCore.SIGNAL("steip(const QString &)"),  
self.container.write)

Is called in the threads run()-method.
Same old behaviour, after adding some more threads the program hangs  
and later dies.

If I try to use a QueuedConnection nothing gets printed at all. Has  
this something to to with the per thread eventloop,
I do not understand this behaviour at all.

Version 2:

self.connect(s, QtCore.SIGNAL("steip(const QString &)"),  
self.write,QtCore.Qt.QueuedConnection)

Is called in the main thread after creating the thread (s).
In this case the QueuedConnection works and I see that my textEdit  
field gets filled.
Furthermore I can create a lot more threads (over 100), can kill and  
recreate them without any problems at all.
When creating a new thread, the connect call is made in the main  
thread too.

So my question is, why does it matter where the connect call is made?

I tried this several times with yesterdays snapshot and everything  
seemed to work ok.

Kind regards,
Michael




More information about the PyQt mailing list