Segfault on PyQt6 6.9.1

Florian Bruhin me at the-compiler.org
Wed Jun 11 11:30:26 BST 2025


Hey,

It looks like this Qt issue, and thus unrelated to PyQt:
https://bugreports.qt.io/browse/QTBUG-137524

Relevant part of the stacktrace with debugging symbols:

    #0  0x00007ffff2b2ad11 in removeWidgetRecursively (li=<optimized out>, w=0x55555597e100) at /usr/src/debug/qt6-base/qtbase/src/widgets/kernel/qlayout.cpp:474
    #1  0x00007ffff2b01c54 in QApplicationPrivate::notify_helper (this=this at entry=0x5555555702c0, receiver=0x5555557b5d20, e=0x7fffffffcf90) at /usr/src/debug/qt6-base/qtbase/src/widgets/kernel/qapplication.cpp:3292
    #2  0x00007ffff2b04f83 in QApplication::notify (this=this at entry=0x5555555dd420, receiver=receiver at entry=0x5555557b5d20, e=e at entry=0x7fffffffcf90) at /usr/src/debug/qt6-base/qtbase/src/widgets/kernel/qapplication.cpp:3064
    #3  0x00007ffff34c5c37 in sipQApplication::notify (this=0x5555555dd420, a0=0x5555557b5d20, a1=0x7fffffffcf90) at /usr/src/debug/pyqt6/pyqt6-6.9.1/build/QtWidgets/sipQtWidgetsQApplication.cpp:249
    #4  0x00007ffff6568118 in QCoreApplication::notifyInternal2 (receiver=0x5555557b5d20, event=0x7fffffffcf90) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qcoreapplication.cpp:1106
    #5  0x00007ffff65ba5dc in QCoreApplication::sendEvent (receiver=<optimized out>, event=0x7fffffffcf90) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qcoreapplication.cpp:1546
    #6  QObjectPrivate::setParent_helper (this=0x55555599af10, o=o at entry=0x0) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qobject.cpp:2268
    #7  0x00007ffff65bf950 in QObject::~QObject (this=<optimized out>, this=<optimized out>) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qobject.cpp:1148
    #8  0x00007ffff2cd7c95 in QMainWindowTabBar::~QMainWindowTabBar (this=<optimized out>, this=<optimized out>) at /usr/src/debug/qt6-base/qtbase/src/widgets/widgets/qmainwindowlayout.cpp:2053
    #9  0x00007ffff2cdc41e in qDeleteAll<QList<QTabBar*>::const_iterator> (begin=..., end=...) at /usr/src/debug/qt6-base/qtbase/src/corelib/tools/qalgorithms.h:28
    #10 qDeleteAll<QList<QTabBar*> > (c=Python Exception <class 'gdb.error'>: value has been optimized out <synthetic pointer>QList<QTabBar *> (size = <optimized out>)) at /usr/src/debug/qt6-base/qtbase/src/corelib/tools/qalgorithms.h:36
    #11 QMainWindowLayout::~QMainWindowLayout (this=<optimized out>, this=<optimized out>) at /usr/src/debug/qt6-base/qtbase/src/widgets/widgets/qmainwindowlayout.cpp:2739
    #12 0x00007ffff2cdcd15 in QMainWindowLayout::~QMainWindowLayout (this=<optimized out>, this=<optimized out>) at /usr/src/debug/qt6-base/qtbase/src/widgets/widgets/qmainwindowlayout.cpp:2741
    #13 0x00007ffff2b44078 in QWidget::~QWidget (this=<optimized out>, this=<optimized out>) at /usr/src/debug/qt6-base/qtbase/src/widgets/kernel/qwidget.cpp:1496
    #14 0x00007ffff3393e9f in sipQMainWindow::~sipQMainWindow (this=<optimized out>, this=<optimized out>) at /usr/src/debug/pyqt6/pyqt6-6.9.1/build/QtWidgets/sipQtWidgetsQMainWindow.cpp:363
    #15 sipQMainWindow::~sipQMainWindow (this=<optimized out>, this=<optimized out>) at /usr/src/debug/pyqt6/pyqt6-6.9.1/build/QtWidgets/sipQtWidgetsQMainWindow.cpp:363
    #16 0x00007ffff6dbf09f in cleanup_qobject (sw=<optimized out>, closure=0x5555555dd420) at ../../qpy/QtCore/qpycore_public_api.cpp:68

Florian

On 2025-06-10T22:09:01 , Phil Thompson wrote:
> On 10/06/2025 13:37, Jonathan Coates wrote:
> > Hi all,
> > 
> > I recently updated to the PyQt6 6.9.1, and started experiencing
> > SIGSEGVs when closing an application. I've narrowed it down to the
> > attached example, and also attached the stacktrace from where the
> > segfault occurs. This is specific to 6.9.1, and does not occur with
> > 6.9.0.
> > 
> > The crash occurs when the QtWidgets.QMainWindow is disposed — either
> > with a `del main_window` or (in the attached example) the stack frame
> > itself is disposed of. I'm happy to debug this further — currently
> > trying to get a debug build of PyQt 6 working, but wanted to check if
> > a) this was a known issue and b) if there were any tips for debugging
> > the generated SIP code?
> > 
> > Many thanks,
> > 
> > Jonathan
> 
> I get a segfault with PyQt v6.9.1 and Qt v6.9.1 but not with Qt v6.9.0. 
> PyQt v6.9.1 is built against Qt v6.9.0 - that shouldn't make a 
> difference. See also...
> 
> https://www.riverbankcomputing.com/static/Docs/PyQt6/gotchas.html#crashes-on-exit
> 
> Phil
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20250611/4d2ecdac/attachment.sig>


More information about the PyQt mailing list