qt5base-lts/tests/auto/widgets
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
..
dialogs CMake: Add BUILTIN_TESTDATA option to qt_internal_add_test 2022-02-11 21:54:44 +01:00
effects Fix tst_qgraphicseffect on Wayland 2021-03-11 08:04:21 +01:00
graphicsview Activate tst_qgraphicsview for Android 2022-02-24 14:34:32 +01:00
itemviews QAbstractItemModel: fix persistent index corruption when moving columns 2022-02-28 09:43:37 +01:00
kernel Fix tst_qformlayout::wrapping on Android 2022-02-24 23:41:14 +01:00
styles CMake: Add BUILTIN_TESTDATA option to qt_internal_add_test 2022-02-11 21:54:44 +01:00
util Position QCompleter popup based on the widget's screen geometry 2022-02-15 01:28:30 +00:00
widgets Activate tst_qopenglwidget for Android 2022-02-22 17:22:58 +01:00
CMakeLists.txt Begin port of qtbase to CMake 2018-11-01 11:48:46 +00:00