Details
-
Bug
-
Resolution: Fixed
-
P1: Critical
-
6.9.1
-
None
-
-
0fa875809 (dev), a3f0ce4c0 (dev), 1b7dea55e (dev), 86b46a011 (dev), 3fd873079 (6.10), 6694c0fbf (6.10), 2de8518d9 (6.10), ca8219583 (6.10), 86c8200e0 (6.9), e14c89299 (6.9), c903337a0 (6.9), 2ffd84d30 (6.9)
Description
Hi devs,
I first posted this on the forums, because I was unsure how to track it down. However, I could identify the very commit that introduced this, so I'm pretty sure it's a regression.
Using Qt 6.9.1, I get a segfault when closing one of my projects. That didn't happen yet with 6.9.0. The backtrace looks like this:
Thread 1 "muckturnier" received signal SIGSEGV, Segmentation fault. 0x0000555555a55b76 in removeWidgetRecursively (li=<optimized out>, w=0x555557254ed0) at /home/tobias/Qt/qtbase-everywhere-src-6.9.1/src/widgets/kernel/qlayout.cpp:474 474 if (child->widget() == w) { (gdb) backtrace #0 0x0000555555a55b76 in removeWidgetRecursively (li=<optimized out>, w=0x555557254ed0) at /home/tobias/Qt/qtbase-everywhere-src-6.9.1/src/widgets/kernel/qlayout.cpp:474 #1 0x0000555555a56e3a in QLayout::widgetEvent (this=<optimized out>, e=e@entry=0x7fffffffca20) at /home/tobias/Qt/qtbase-everywhere-src-6.9.1/src/widgets/kernel/qlayout.cpp:530 #2 0x0000555555a24dab in QApplicationPrivate::notify_helper (this=this@entry=0x555556ebd220, receiver=receiver@entry=0x7fffffffce60, e=e@entry=0x7fffffffca20) at /home/tobias/Qt/qtbase-everywhere-src-6.9.1/src/widgets/kernel/qapplication.cpp:3292 #3 0x0000555555a354b5 in QApplication::notify (this=0x7fffffffcd10, receiver=0x7fffffffce60, e=0x7fffffffca20) at /home/tobias/Qt/qtbase-everywhere-src-6.9.1/src/widgets/kernel/qapplication.cpp:3249 #4 0x00005555563fcde4 in QCoreApplication::notifyInternal2 (receiver=0x7fffffffce60, event=event@entry=0x7fffffffca20) at /home/tobias/Qt/qtbase-everywhere-src-6.9.1/src/corelib/kernel/qcoreapplication.cpp:1106 #5 0x00005555563fce8f in QCoreApplication::sendEvent (receiver=<optimized out>, event=event@entry=0x7fffffffca20) at /home/tobias/Qt/qtbase-everywhere-src-6.9.1/src/corelib/kernel/qcoreapplication.cpp:1546 #6 0x0000555556437c46 in QObjectPrivate::setParent_helper (this=this@entry=0x555556fef340, o=o@entry=0x0) at /home/tobias/Qt/qtbase-everywhere-src-6.9.1/src/corelib/kernel/qobject.cpp:2268 #7 0x00005555564383f0 in QObject::~QObject (this=<optimized out>, __in_chrg=<optimized out>) at /home/tobias/Qt/qtbase-everywhere-src-6.9.1/src/corelib/kernel/qobject.cpp:1148 #8 0x0000555555a7d408 in QWidget::~QWidget (this=0x555557254ed0, __in_chrg=<optimized out>) at /home/tobias/Qt/qtbase-everywhere-src-6.9.1/src/widgets/kernel/qwidget.cpp:1596 #9 0x0000555555b9a8e0 in QTabBar::~QTabBar (this=<optimized out>, __in_chrg=<optimized out>) at /home/tobias/Qt/qtbase-everywhere-src-6.9.1/src/widgets/widgets/qtabbar.cpp:863 #10 0x0000555555b541e8 in QMainWindowTabBar::~QMainWindowTabBar (this=0x555557254ed0, __in_chrg=<optimized out>) at /home/tobias/Qt/qtbase-everywhere-src-6.9.1/src/widgets/widgets/qmainwindowlayout.cpp:2053 #11 0x0000555555b54221 in QMainWindowTabBar::~QMainWindowTabBar (this=0x555557254ed0, __in_chrg=<optimized out>) at /home/tobias/Qt/qtbase-everywhere-src-6.9.1/src/widgets/widgets/qmainwindowlayout.cpp:2053 #12 0x0000555555b4b0da in qDeleteAll<QList<QTabBar*>::const_iterator> (begin=..., end=...) at /home/tobias/Qt/qtbase-everywhere-src-6.9.1/src/corelib/tools/qalgorithms.h:28 #13 0x0000555555b4b0ff in qDeleteAll<QList<QTabBar*> > (c=...) at /home/tobias/Qt/qtbase-everywhere-src-6.9.1/src/corelib/tools/qalgorithms.h:36 #14 0x0000555555b4cba8 in QMainWindowLayout::~QMainWindowLayout (this=0x55555731abb0, __in_chrg=<optimized out>) at /home/tobias/Qt/qtbase-everywhere-src-6.9.1/src/widgets/widgets/qmainwindowlayout.cpp:2739 #15 0x0000555555b4ccb1 in QMainWindowLayout::~QMainWindowLayout (this=0x55555731abb0, __in_chrg=<optimized out>) at /home/tobias/Qt/qtbase-everywhere-src-6.9.1/src/widgets/widgets/qmainwindowlayout.cpp:2741 #16 0x0000555555a7d17c in QWidget::~QWidget (this=0x7fffffffce60, __in_chrg=<optimized out>) at /home/tobias/Qt/qtbase-everywhere-src-6.9.1/src/widgets/kernel/qwidget.cpp:1496 #17 0x0000555555b42c14 in QMainWindow::~QMainWindow (this=<optimized out>, __in_chrg=<optimized out>) at /home/tobias/Qt/qtbase-everywhere-src-6.9.1/src/widgets/widgets/qmainwindow.cpp:338 #18 0x00005555556aaae6 in MainWindow::~MainWindow (this=0x7fffffffce60, __in_chrg=<optimized out>) at /home/tobias/tmp/git/muckturnier/src/MainWindow/MainWindow.h:46 #19 0x00005555556fc0d5 in main (argc=1, argv=0x7fffffffd178) at /home/tobias/tmp/git/muckturnier/src/main.cpp:130
Executing step by step revaled that this happens inside Qt code, way after any of my stuff is executed:
QCoreApplication::exec () at /home/tobias/Qt/qtbase-everywhere-src-6.9.1/src/corelib/kernel/qcoreapplication.cpp:1450 1450 threadData->quitNow = false; (gdb) n 1452 if (self) (gdb) n 1453 self->d_func()->execCleanup(); (gdb) n 1455 return returnCode; (gdb) n main (argc=1, argv=0x7fffffffd178) at /home/tobias/tmp/git/muckturnier/src/main.cpp:130 130 } (gdb) n Thread 1 "muckturnier" received signal SIGSEGV, Segmentation fault. 0x0000555555a55b76 in removeWidgetRecursively (li=<optimized out>, w=0x5555571eec40) at /home/tobias/Qt/qtbase-everywhere-src-6.9.1/src/widgets/kernel/qlayout.cpp:474 474 if (child->widget() == w) { (gdb) n [Thread 0x7ffff49e7900 (LWP 10439) exited] [Thread 0x7ffff45ff6c0 (LWP 10442) exited] [New process 10439] Program terminated with signal SIGSEGV, Segmentation fault. The program no longer exists.
Line 130 of my main.cpp is at the very end, after return application.exec():
129 return application.exec();
130 }
131
The commit that introduced the crash is ab6f1ad77852a427ae73172ca11dacf876a0cbf7.
If I checkout
commit 19c4db4201e8933fbbbf951809ceff30e99b4458
QDockWidget: don't access a QMainWindow that's under destruction
everything is fine, no crash. One commit later, at
commit ab6f1ad77852a427ae73172ca11dacf876a0cbf7 QMainWindowLayout: Fix leaking of unused tab bars
I get the segfault.
It's quite hard to create a minimal example, the project had about 55,000 lines of code, and the layouts, dock widgets and so on are quite complex … however, I hope this info is sufficient to at least have a starting point.
I'll happily help to track this down if I can!