qt5base-lts/tests/auto
David Faure 74a4d88e9a QAbstractItemModel: fix persistent index corruption when moving columns
QHeaderView creates persistent indexes in
_q_sectionsAboutToBeChanged(), called by the slot connected to
rowsAboutToBeMoved/columnsAboutToBeMoved.

In the case of rows, QAbstractItemModel emits the signal *before*
preparing to update persistent indexes in itemsAboutToBeMoved(),
so it can see the ones newly created by QHeaderView, all is well.

In the case of columns, the emit was done *after* calling
itemsAboutToBeMoved(), so the additional persistent indexes created by
QHeaderView were ignored, and in endMoveRows() we could end up with:
ASSERT failure in QPersistentModelIndex::~QPersistentModelIndex: "persistent model indexes corrupted"

This bug has been there since the very beginning of beginMoveColumns(),
but was undetected because moving columns in a model is pretty rare
(in my case there's a QTransposeProxyModel that turns columns into
rows in the underlying model, and a proxy that handles dropMimeData...)

Pick-to: 6.3 6.2 5.15
Change-Id: I74bad137594019a04c2a19c2abb351ff3065c25a
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2022-02-28 09:43:37 +01:00
..
bic/data Add BC files for 6.2.0 2022-01-07 13:31:38 +00:00
cmake Bump version from 6.2.0 to 6.4.0 in tests as well 2022-01-31 17:20:06 +02:00
concurrent Fix memory leak in QtConcurrent::run when called with a NULL QThreadPool 2022-01-24 22:40:35 +01:00
corelib Fix test when accessing patched plugin too fast 2022-02-25 14:52:34 +02:00
dbus tests: Remove unused SRCDIR defines 2021-08-17 12:41:57 +00:00
gui QGuiApplication: use translation-based layout direction unless explicitly set 2022-02-24 19:46:01 +01:00
guiapplauncher
network tst_qnetworkcookiejar: Remove tests that rely on public suffix database format 2022-02-24 19:36:26 +01:00
opengl
other Fix tst_qaccessibility on Android 2022-02-25 13:52:33 +01:00
printsupport QtBase: replace windows.h with qt_windows.h 2021-11-23 12:53:46 +08:00
shared Remove false Q_UNREACHABLE from shaping code 2021-02-03 09:44:44 +01:00
sql Add spaces round operators and at starts of comment texts 2022-02-17 15:51:31 +01:00
testlib CMake: Add BUILTIN_TESTDATA option to qt_internal_add_test 2022-02-11 21:54:44 +01:00
tools typeNameForCast: use add_pointer instead of string manipulation 2022-02-18 13:44:41 +01:00
widgets QAbstractItemModel: fix persistent index corruption when moving columns 2022-02-28 09:43:37 +01:00
xml Activate tst_qdom for Android 2022-02-22 17:22:58 +01:00
CMakeLists.txt Don't build tests/auto/tools when cross-compiling 2021-10-07 08:03:40 +02:00
network-settings.h