diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-01-28 19:31:24 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2020-02-09 17:41:52 +0100 |
commit | 7caaf4eb7f8b536de2a77db59fdd7acba2a566a7 (patch) | |
tree | 43397dc75f482cdf2f9958baf9330807ccaa609b /examples/widgets/effects/fademessage/fademessage.cpp | |
parent | dfaa61482c483117b2d9728c0e9487fc2f8196c9 (diff) |
Don't rely on iterators being stable while modifying the hash
The Mapping struct referred to where it got inserted into the
source_index mapping table by a const iterator to the table. That
is rather fragile, as changing the table invalidates the iterator.
It happened to work with QHash in Qt 5, but will break with the new
implementation in Qt 6.
Instead simply store the key in the Mapping struct so that it can
be quickly found in the hash.
Also fix one place, where we unconditionally call erase on an iterator
returned by constFind(). Turns out constFind() did sometimes not find
the item in question and returns end().
Change-Id: I0420a06d496f640a3150478e8c644d4cc669ceff
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'examples/widgets/effects/fademessage/fademessage.cpp')
0 files changed, 0 insertions, 0 deletions