use more efficient iterate and clear for removal

This commit is contained in:
Stephen Birarda 2018-09-10 11:10:08 -07:00
parent adac872a11
commit a50e55b83a

View file

@ -436,9 +436,9 @@ void AvatarHashMap::sessionUUIDChanged(const QUuid& sessionUUID, const QUuid& ol
void AvatarHashMap::clearOtherAvatars() {
QWriteLocker locker(&_hashLock);
AvatarHash::iterator avatarIterator = _avatarHash.begin();
while (avatarIterator != _avatarHash.end()) {
handleRemovedAvatar(*avatarIterator);
avatarIterator = _avatarHash.erase(avatarIterator);
for (auto& av : _avatarHash) {
handleRemovedAvatar(av);
}
_avatarHash.clear();
}