Amends 32edae5e268b968aff82f0713612eff2feffb4e1, 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.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> (cherry picked from commit 9ea9e2476d72ae67178d55df99419f202b36131f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This directory contains autotests and benchmarks based on Qt Test. In order to run the autotests reliably, you need to configure a desktop to match the test environment that these tests are written for. Linux X11: * The user must be logged in to an active desktop; you can't run the autotests without a valid DISPLAY that allows X11 connections. * The tests are run against a KDE3 or KDE4 desktop. * Window manager uses "click to focus", and not "focus follows mouse". Many tests move the mouse cursor around and expect this to not affect focus and activation. * Disable "click to activate", i.e., when a window is opened, the window manager should automatically activate it (give it input focus) and not wait for the user to click the window.