Commit 7caaf4eb authored by Lars Knoll's avatar Lars Knoll
Browse files

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: default avatarLars Knoll <lars.knoll@qt.io>
Reviewed-by: default avatarMårten Nordheim <marten.nordheim@qt.io>
No related merge requests found
Showing with 9 additions and 6 deletions
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment