[PyQt] Application crash on exit under Linux
Kovid Goyal
kovid at kovidgoyal.net
Tue Aug 12 10:37:08 BST 2014
del the app object explicitly before calling exit() and your program wont
crash. Simpolarly if it has a main window del that explicitly before
deleting the app object.
Kovid.
On Tue, Aug 12, 2014 at 05:26:58PM +0800, Xinkai wrote:
> Hello,
>
> A PyQt program can sometimes crash when exit. The program can be as
> simple as this one.
>
> ```
> #!/usr/bin/python3
> # -*- coding: utf-8 -*-
>
> from PyQt5.QtWidgets import QApplication, QMainWindow
> import sys
>
>
> class DummyApp(QApplication):
> def __init__(self, *args):
> super().__init__(*args)
> self.w = QMainWindow(None)
> self.w.show()
>
> if __name__ == "__main__":
> app = DummyApp([])
> sys.exit(app.exec())
> ```
>
> dmesg shows:
> [Aug12 17:12] QXcbEventReader[12528]: segfault at 7fd2cd05eb19 ip
> 00007fd2cd05eb19 sp 00007fd2ca624ee0 error 14
>
> gdb python core.dump shows:
> Core was generated by `/usr/bin/python3 ./issue25.py'.
> Program terminated with signal SIGSEGV, Segmentation fault.
> #0 0x00007fd2cd05eb19 in ?? ()
> (gdb) bt
> #0 0x00007fd2cd05eb19 in ?? ()
> #1 0x00007fd2ca624f10 in ?? ()
> #2 0x00000000011a5f10 in ?? ()
> #3 0x00007fd2ca624f50 in ?? ()
> #4 0x00000000011a6270 in ?? ()
> #5 0x00007fd2ca625700 in ?? ()
> #6 0x00007fd2d61354fe in ?? () from /usr/lib/libQt5Core.so.5
> Backtrace stopped: previous frame inner to this frame (corrupt stack?)
>
> The dmesg and coredump info above were made on an Arch x64, with Python
> 3.4.1 and PyQt 5.3.2-snapshot-dcc21846e00f. Similar crashes can also
> happen to Ubuntu 14.04(PyQt 5.2.x).
>
> I don't know if these information is enough. I compiled PyQt with Arch
> Build System. I specified "options=(debug !strip)" and added "--debug"
> in the "configure.py" line. Still I am getting these not-so-intuitive
> backtrace. Maybe someone can tell me how to generate a more detailed
> backtrace?
>
>
> Kind wishes,
>
> Xinkai
>
>
>
> !DSPAM:3,53e9de1016781510520225!
> _______________________________________________
> PyQt mailing list PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
> !DSPAM:3,53e9de1016781510520225!
--
_____________________________________
Dr. Kovid Goyal
http://www.kovidgoyal.net
http://calibre-ebook.com
_____________________________________
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20140812/ad588160/attachment.sig>
More information about the PyQt
mailing list