[PyQt] PyQt5 segfault when closing a QMainWindow

Roger Leigh rleigh at debian.org
Mon Jul 29 22:36:17 BST 2013


Hi,

I've just started experimenting with Python 3.3/Qt 5.1/PyQt 5.0 on
Debian (unstable, amd64).

With the following trivial program, I can reproducibly observe a
segfault when the window is closed:

----------------------------------------------------------------------
#!/usr/bin/python3

from PyQt5.QtWidgets import (QApplication, QMainWindow)

if __name__ == "__main__":
    import sys
    app = QApplication(sys.argv)
    w = QMainWindow()
    w.show()
    sys.exit(app.exec())
----------------------------------------------------------------------

==> segfault when the window close button is pressed (i.e. from the
    window manager, kdm in this case)
    This occurs about 1 time in 10 on my system.  From the backtrace,
    it looks like it's thread-related, or at least occuring in a
    thread, but I'm afraid I've not been able to get more details
    other than what's below.  I'll be happy to investigate in more
    detail if you could give me some hints on what to look at.

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffef9b4700 (LWP 7751)]
0x00007ffff1948b79 in QXcbEventReader::run (this=0xc92930) at qxcbconnection.cpp:983
983     qxcbconnection.cpp: No such file or directory.
(gdb) bt
#0  0x00007ffff1948b79 in QXcbEventReader::run (this=0xc92930) at qxcbconnection.cpp:983
#1  0x00007ffff4f0d6b0 in QThreadPrivate::start (arg=0xc92930) at thread/qthread_unix.cpp:339
#2  0x00007ffff7bc6e0e in start_thread (arg=0x7fffef9b4700) at pthread_create.c:311
#3  0x00007ffff6dc493d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffef9b4700 (LWP 8090)]
0x00007ffff1948b79 in ?? ()
(gdb) bt
#0  0x00007ffff1948b79 in ?? ()
#1  0x0000000000c92b40 in ?? ()
#2  0x00007fffef9b3eb0 in ?? ()
#3  0x0000000000c92df0 in ?? ()
#4  0x00007ffff4f0d6b0 in QThreadPrivate::start (arg=0xc92b40) at thread/qthread_unix.cpp:339
#5  0x00007ffff7bc6e0e in start_thread (arg=0x7fffef9b4700) at pthread_create.c:311
#6  0x00007ffff6dc493d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffef9b4700 (LWP 8119)]
0x00007ffff1948b79 in QXcbEventReader::run (this=0xc92af0) at qxcbconnection.cpp:983
983     qxcbconnection.cpp: No such file or directory.
(gdb) bt
#0  0x00007ffff1948b79 in QXcbEventReader::run (this=0xc92af0) at qxcbconnection.cpp:983
#1  0x00007ffff4f0d6b0 in QThreadPrivate::start (arg=0xc92af0) at thread/qthread_unix.cpp:339
#2  0x00007ffff7bc6e0e in start_thread (arg=0x7fffef9b4700) at pthread_create.c:311
#3  0x00007ffff6dc493d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffef9b4700 (LWP 8132)]
0x00007ffff1948b79 in ?? ()
(gdb) bt
#0  0x00007ffff1948b79 in ?? ()
#1  0x0000000000c92b90 in ?? ()
#2  0x00007fffef9b3eb0 in ?? ()
#3  0x0000000000c92e40 in ?? ()
#4  0x00007ffff4f0d6b0 in QThreadPrivate::start (arg=0xc92b90) at thread/qthread_unix.cpp:339
#5  0x00007ffff7bc6e0e in start_thread (arg=0x7fffef9b4700) at pthread_create.c:311
#6  0x00007ffff6dc493d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113

I've tried to reproduce this with plain C++ and Qt using the following
program identical to the python version.  However, I've not as yet
been able to observe a segfault.

----------------------------------------------------------------------
#include <QApplication>
#include <QMainWindow>
#include <cstdlib>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QMainWindow w;
    w.show();
    return a.exec();
}
----------------------------------------------------------------------


Regards,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please GPG sign your mail.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20130729/c47ead02/attachment.pgp>


More information about the PyQt mailing list