qt6-bb10/src/corelib
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
..
animation QtCore: use C++11 thread_local instead of QThreadStorage 2022-02-03 19:58:36 -08:00
compat Move QBindingStorage methods marked for removal to removed_api 2022-02-16 02:28:53 +01:00
doc wasm: move user configurable settings 2022-02-23 12:04:37 +10:00
global QRandomGenerator: find getentropy() on macOS 2022-02-24 12:29:43 -08:00
io Make sure all qtbase private headers include at least one other 2022-02-24 12:07:00 -08:00
itemmodels QAbstractItemModel: fix persistent index corruption when moving columns 2022-02-28 09:43:37 +01:00
kernel Make sure all qtbase private headers include at least one other 2022-02-24 12:07:00 -08:00
mimetypes MimeDatabase::mimeTypeForFileNameAndData: Do not open file unnecessarily 2022-02-23 08:44:23 +01:00
platform Make sure all qtbase private headers include at least one other 2022-02-24 12:07:00 -08:00
plugin QPluginParsedMetaData: avoid the indirection through QCborMap 2022-02-16 01:59:51 -08:00
serialization Make sure all qtbase private headers include at least one other 2022-02-24 12:07:00 -08:00
text Don't allocate in qt_asciiToDouble() 2022-02-25 08:08:21 +00:00
thread Make sure all qtbase private headers include at least one other 2022-02-24 12:07:00 -08:00
time Protect headers against min/max macros 2022-02-22 20:12:29 +00:00
tools Make sure all qtbase private headers include at least one other 2022-02-24 12:07:00 -08:00
CMakeLists.txt Add back accidentally removed check for QT_FEATURE_system_zlib 2022-02-23 17:41:59 +01:00
Qt6AndroidMacros.cmake Allow calling qt6_android_add_apk_target twice 2022-02-24 03:42:28 +01:00
Qt6CTestMacros.cmake Replace BUILD_OPTIONS_LIST variable by the getter function 2021-12-02 16:34:22 +01:00
Qt6CoreConfigExtras.cmake.in CMake: Deduce install prefix of example in qt_internal_add_example 2022-02-01 16:51:00 +01:00
Qt6CoreConfigureFileTemplate.in CMake: Fix unnecessary rebuilding upon reconfiguration 2020-10-30 17:19:27 +01:00
Qt6CoreDeploySupport.cmake CMake: Clean up qt_deploy_qt_conf for 6.3 2022-02-21 14:07:52 +01:00
Qt6CoreMacros.cmake CMake: Clean up qt_deploy_qt_conf for 6.3 2022-02-21 14:07:52 +01:00
Qt6WasmMacros.cmake wasm: move user configurable settings 2022-02-23 12:04:37 +10:00
QtCore.dynlist Remove old pre-6.0 hooks 2021-10-22 19:12:07 -07:00
configure.cmake QRandomGenerator: find getentropy() on macOS 2022-02-24 12:29:43 -08:00
debug_script.py Fix lldbbridge.py loading when using lldb + Python 3 from CLI 2021-09-07 12:53:37 +02:00
qt_cmdline.cmake CMake: Re-implement configure/qmake's command line handling in CMake 2020-08-17 08:08:20 +02:00
qtcore.tracepoints Reduce amount of tracepoints required for event tracking 2019-05-02 14:15:58 +00:00