qt6-bb10/tests/auto/widgets/widgets
Volker Hilsheimer 9ea9e2476d QMainWindow: don't crash when restored state is modified before applied
Amends 32edae5e26, after which we keep a
copy of the restored state if the state couldn't be applied yet. Since
making a copy of the entire state results in multiple copies of layout
item pointers, we might end up with dangling pointers if the layout
structure is modified while we keep the copy. This can happen if methods
such as tabifyDockWidgets or splitDockWidget get called; e.g. tabifying
dock widgets will destroy the layout items that were added for them.

Unfortunately, the layout items do not have a pointer back to the layout
they live in, and the items in the stored state might not yet live in a
layout anyway. So we cannot remove the items from their layout in a
QDockWidgetItem destructor implementation.

Instead, we have to forget the stored state. Add a helper function that
writes the stored state back to the actual state, and deletes the stored
state afterwards. Call this function when the layout might get modified
programmatically.

Add a test case that reproduces the crash without the fix, and passes
with the patch.

Fixes: QTBUG-120025
Pick-to: 6.7 6.6 6.5
Change-Id: I8f7e886f3c4ac38e25f9b8bc194eea0833e5974f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-12-13 15:15:24 +01:00
..
qabstractbutton CMake: Make widgets tests standalone projects 2023-07-05 15:09:32 +02:00
qabstractscrollarea QAbstractScrollArea: Don't include size of invisible scrollbars 2023-07-11 01:34:19 +02:00
qabstractslider CMake: Make widgets tests standalone projects 2023-07-05 15:09:32 +02:00
qabstractspinbox CMake: Make widgets tests standalone projects 2023-07-05 15:09:32 +02:00
qbuttongroup CMake: Make widgets tests standalone projects 2023-07-05 15:09:32 +02:00
qcalendarwidget CMake: Make widgets tests standalone projects 2023-07-05 15:09:32 +02:00
qcheckbox QCheckBox: Don't emit checkStateChanged when nothing changed 2023-11-08 11:11:48 +01:00
qcombobox QComboBox: don't eat non-printable key strokes 2023-11-23 10:33:28 +00:00
qcommandlinkbutton CMake: Make widgets tests standalone projects 2023-07-05 15:09:32 +02:00
qdatetimeedit Suppress deprecation warnings in test of QDTE::timeSpec property 2023-10-26 16:57:01 +02:00
qdial QDial: don't crash when min==max and setting a value != min & max 2023-11-12 23:45:30 +01:00
qdialogbuttonbox Explicitly focus automatic default button in QDialogButtonBox inside dialog 2023-10-26 00:14:33 +02:00
qdockwidget QDockWidget: Fix group unplugging 2023-11-18 20:48:44 +01:00
qdoublespinbox CMake: Make widgets tests standalone projects 2023-07-05 15:09:32 +02:00
qfocusframe CMake: Make widgets tests standalone projects 2023-07-05 15:09:32 +02:00
qfontcombobox CMake: Make widgets tests standalone projects 2023-07-05 15:09:32 +02:00
qframe CMake: Make widgets tests standalone projects 2023-07-05 15:09:32 +02:00
qgroupbox tst_QGroupBox: port away from Q_FOREACH 2023-08-07 21:56:10 +00:00
qkeysequenceedit CMake: Make widgets tests standalone projects 2023-07-05 15:09:32 +02:00
qlabel CMake: Make widgets tests standalone projects 2023-07-05 15:09:32 +02:00
qlcdnumber CMake: Make widgets tests standalone projects 2023-07-05 15:09:32 +02:00
qlineedit Configure tst_qlineedit correctly for VxWorks 2023-11-27 20:43:36 +01:00
qmainwindow QMainWindow: don't crash when restored state is modified before applied 2023-12-13 15:15:24 +01:00
qmdiarea Tests: remove blacklisted CIs no longer available 2023-12-06 22:07:44 +01:00
qmdisubwindow CMake: Make widgets tests standalone projects 2023-07-05 15:09:32 +02:00
qmenu CMake: Make widgets tests standalone projects 2023-07-05 15:09:32 +02:00
qmenubar Tests: remove blacklisted CIs no longer available 2023-12-06 22:07:44 +01:00
qopenglwidget Tests: remove blacklisted CIs no longer available 2023-12-06 22:07:44 +01:00
qplaintextedit QtWidgets tests: port remaining users away from Q_FOREACH 2023-08-14 23:11:54 +03:00
qprogressbar CMake: Make widgets tests standalone projects 2023-07-05 15:09:32 +02:00
qpushbutton CMake: Make widgets tests standalone projects 2023-07-05 15:09:32 +02:00
qradiobutton CMake: Make widgets tests standalone projects 2023-07-05 15:09:32 +02:00
qrhiwidget Enable QWidget::grab() with QRhiWidget in the widget tree 2023-08-28 21:14:28 +02:00
qscrollarea CMake: Make widgets tests standalone projects 2023-07-05 15:09:32 +02:00
qscrollbar CMake: Make widgets tests standalone projects 2023-07-05 15:09:32 +02:00
qsizegrip CMake: Make widgets tests standalone projects 2023-07-05 15:09:32 +02:00
qslider CMake: Make widgets tests standalone projects 2023-07-05 15:09:32 +02:00
qspinbox Tests: remove blacklisted CIs no longer available 2023-12-06 22:07:44 +01:00
qsplashscreen CMake: Make widgets tests standalone projects 2023-07-05 15:09:32 +02:00
qsplitter tst_QSplitter: fix compiler warning 2023-09-01 00:11:51 +02:00
qstackedwidget CMake: Make widgets tests standalone projects 2023-07-05 15:09:32 +02:00
qstatusbar CMake: Make widgets tests standalone projects 2023-07-05 15:09:32 +02:00
qtabbar QTabBar: properly calc tab positions when changing tab position 2023-12-07 08:41:01 +01:00
qtabwidget QTabWidget/Bar: ignore hidden tabs for key events 2023-11-09 20:57:43 +01:00
qtextbrowser CMake: Make widgets tests standalone projects 2023-07-05 15:09:32 +02:00
qtextedit QtWidgets tests: port remaining users away from Q_FOREACH 2023-08-14 23:11:54 +03:00
qtoolbar CMake: Make widgets tests standalone projects 2023-07-05 15:09:32 +02:00
qtoolbox CMake: Make widgets tests standalone projects 2023-07-05 15:09:32 +02:00
qtoolbutton CMake: Make widgets tests standalone projects 2023-07-05 15:09:32 +02:00
CMakeLists.txt Add QRhiWidget 2023-08-14 17:05:36 +02:00