qt6-bb10/tests/auto
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
..
bic/data Add binary compatibility file for 6.6.0 2023-10-17 22:23:42 +03:00
cmake Bump version to 6.8.0 2023-12-11 17:35:40 +02:00
concurrent QtConcurrent::run() test: Add tests taking static function 2023-11-09 16:52:44 +00:00
corelib QBitArray: add rvalue binary bitwise operators 2023-12-12 22:59:23 -08:00
dbus QDBusConnectionPrivate: Close connection after failed q_dbus_bus_register() 2023-12-07 23:36:15 +01:00
gui QIcon: prefer downscaling over upscaling pixmap icons 2023-12-13 15:10:51 +01:00
guiapplauncher Move Weather Anchor Layout example to manual tests 2023-03-02 05:55:57 +01:00
network Add PATCH support for QRestAccessManager 2023-12-08 15:53:36 +02:00
opengl tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
other Tests: remove blacklisted CIs no longer available 2023-12-06 22:07:44 +01:00
printsupport Dialogs: clean up native dialogs when object gets destroyed 2023-09-06 23:12:33 +02:00
shared coretext: Support variable application fonts 2023-10-03 19:25:46 +02:00
sql SQLite: Handle identifiers correctly 2023-09-28 20:51:33 +08:00
testlib Long live QDebug::operator<<(q(u)int128)! 2023-12-09 21:00:13 +01:00
tools qdbuscpp2xml: Register QtDBus metatypes 2023-11-28 13:37:56 +01:00
wasm CMake: Remove deprecated PUBLIC_LIBRARIES option in wasm tests 2023-11-29 15:00:57 +00:00
widgets QMainWindow: don't crash when restored state is modified before applied 2023-12-13 15:15:24 +01:00
xml CMake: Make qtbase tests standalone projects 2023-07-05 15:09:32 +02:00
CMakeLists.txt CI: Enable some tests under corelib/thread for Wasm platform 2023-09-14 11:58:48 +02:00
network-settings.h QtNetworkSettings: narrow down hasIPv6 to specific OSes 2023-08-29 07:20:51 -07:00