QMetaTypeCustomRegistry: use QHash::removeIf() instead of a custom erasing loop
Use QHash::removeIf() instead of a custom erasing loop on aliases table when unregister custom type. It will still always detach even if nothing needs to be removed, since QHash::removeIf() always detaches. But this can potentially be fixed in the future, so it will be improved indirectly. Besides other things this also silences Clazy's "mixing iterators" warning. Change-Id: I3d6e8b0ed7dc10807570a0b0feac7eda6a0e572a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>bb10
parent
5ad12ab57d
commit
b15f4399f4
|
|
@ -150,13 +150,7 @@ struct QMetaTypeCustomRegistry
|
|||
auto &ti = registry[idx];
|
||||
|
||||
// We must unregister all names.
|
||||
auto it = aliases.begin();
|
||||
while (it != aliases.end()) {
|
||||
if (it.value() == ti)
|
||||
it = aliases.erase(it);
|
||||
else
|
||||
++it;
|
||||
}
|
||||
aliases.removeIf([ti] (const auto &kv) { return kv.value() == ti; });
|
||||
|
||||
ti = nullptr;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue