[PyQt] segfault : interpreting back trace

Giovanni Bajo rasky at develer.com
Mon Nov 24 11:54:39 GMT 2008


On dom, 2008-11-23 at 23:47 +0100, Erik Janssens wrote:
> Hi,
> 
> I'm having a pyqt segmentation fault, and I cannot find out what is
> causing it.  Can somebody make some suggestions on how to handle this ?
> 
> I tried to use gdb to get a back trace, but it doesn't make much sense
> to me, it seems to be related to a c-function call, but I don't know
> which one (back trace below)
> 
> Any help or suggestion is appreciated.

Let's see if my psychic debugging works well today ;)

I see this:

#24 0x08126311 in t_bootstrap (boot_raw=0x84a5588)
at ../Modules/threadmodule.c:424
#25 0xb7f0a4fb in start_thread ()
from /lib/tls/i686/cmov/libpthread.so.0

which makes me believe you're using multi-threading in your problem.
(It's normal to have crashes with threading program, and that's why you
shouldn't use threads at all unless absolutely necessary -- which is
almost never).

I also see that you're doing it through threadmodule.c, so Python's
threading API. Please keep in mind that:
 
 1) You shouldn't be using Python threading API with Qt. It's probably
fine if your thread is 100% Python-only, but as soon as you touch *any*
Qt's API, you can get random crashes. Use QThread instead.

 2) Make sure to have read and understood all the requirements for
multi-thread programming with Qt. Specifically, you can't directly
touch/modify/read *any* widget from the secondary thread. You should
instead post events to the main thread, or use the asynchronous
signal/slot mechanism.
-- 
Giovanni Bajo
Develer S.r.l.
http://www.develer.com




More information about the PyQt mailing list