diff options
author | Mårten Nordheim <marten.nordheim@qt.io> | 2021-06-16 11:40:04 +0200 |
---|---|---|
committer | Mårten Nordheim <marten.nordheim@qt.io> | 2021-06-18 11:20:40 +0200 |
commit | ea7d87b5b59ded22b145ecbb4dd648ecfd1abbdd (patch) | |
tree | 0cd7fdf5b09759fc2cb75e8b2972d17502c0ed0c /tests/auto/corelib/tools/qpoint | |
parent | 30f1f02cf74617bb53a4aa997c1e8d05e98e5f5d (diff) |
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>
Diffstat (limited to 'tests/auto/corelib/tools/qpoint')
0 files changed, 0 insertions, 0 deletions