qt5base-lts/tests/auto/corelib/tools/qhash
Mårten Nordheim ea7d87b5b5 QHash: Fix erase() edge-case
When the element you want to erase is the last element AND the
next element (element 0), when rehashed, would be relocated to the last
element, this leads to the state below. Which is similar to a test in
tst_qhash for some seeds.

auto it = hash.begin + (hash.size - 1)
it = hash.erase(it)
it != hash.end

By forcing the iterator to increment if we were erasing the last element
we always end up with a pointer which is equal to hash.end

Befriend the tst_qhash class so we can set the seed to a known-bad one

Pick-to: 6.2 6.1
Change-Id: Ie0b175003a2acb175ef5e3ab5a984e010f65d986
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-06-18 11:20:40 +02:00
..
.gitignore Moving relevant tests to corelib/tools 2011-09-01 13:07:23 +02:00
CMakeLists.txt CMake: Regenerate projects to use new qt_internal_ API 2020-09-23 16:59:06 +02:00
tst_qhash.cpp QHash: Fix erase() edge-case 2021-06-18 11:20:40 +02:00