[PyQt] Problems with QThreads and python threads

Andrea Cimino andreacimino at gmail.com
Wed Aug 1 21:30:15 BST 2007

Hi There!
I have a questions and some problems related to PyQt4.
I am developing a PyQt4 application and i have some problems mixing PyQt4 
threads and python threads that's the situation:
from QThread class i start some python methods that launch other threads (some 
connections via urllib2). The point is that my program, when the QThread is 
running some time crashes (C++ side), and that's reaaaly annoing.
I got messages like:

** glibc detected *** python: double free or corruption (out): 
0x00002b7d3fcd5a10 **

So i said.. "maybe my python code has some bugs".. maybe... in Windows and 
MacOSX the same problems...
Then i tried to launch my program in a Ubuntu 7.04 environment and... no more 
crashes! i decided to investigate.. seems that the combination that works is 
sip 4.5 + PyQt 4.1. Any other compilation (also with PyQt4.3 and sip 4.7) 
crashes.  Looking at the Sip and PyQt code i have noticed that  a lot of 
changes has been made to threads modules  (sip 4.5 -> sip 4.6) (specially sip 
Also i have noticed that, when i close my program, with sip 4.5 and PyQt4.1 i 
get messages like (that ovbiously if i run the threads)

QThread: Destroyed while thread is still running
QThread: Destroyed while thread is still running

Instead, in the new versions, i have no messages... that sounds me a bit 
strange. I can also give you privately the sources of my program to have a 
proof of what i say.

Andrea Cimino

More information about the PyQt mailing list