mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 18:50:00 +02:00
Merge pull request #3645 from birarda/avatar-by-name
fix for AvatarHashMap crash when erasing avatars
This commit is contained in:
commit
246ff1614f
1 changed files with 7 additions and 13 deletions
|
@ -58,27 +58,21 @@ bool AvatarHashMap::containsAvatarWithDisplayName(const QString& displayName) {
|
||||||
}
|
}
|
||||||
|
|
||||||
AvatarData* AvatarHashMap::avatarWithDisplayName(const QString& displayName) {
|
AvatarData* AvatarHashMap::avatarWithDisplayName(const QString& displayName) {
|
||||||
AvatarHash::iterator avatarIterator = _avatarHash.begin();
|
foreach(const AvatarSharedPointer& sharedAvatar, _avatarHash) {
|
||||||
while (avatarIterator != _avatarHash.end()) {
|
if (sharedAvatar->getDisplayName() == displayName) {
|
||||||
AvatarSharedPointer sharedAvatar = avatarIterator.value();
|
|
||||||
if (avatarIterator.value()->getDisplayName() == displayName) {
|
|
||||||
// this is a match
|
// this is a match
|
||||||
// check if this avatar should still be around
|
// check if this avatar should still be around
|
||||||
if (!shouldKillAvatar(sharedAvatar)) {
|
if (!shouldKillAvatar(sharedAvatar)) {
|
||||||
// we have a match, return true
|
// we have a match, return the AvatarData
|
||||||
return sharedAvatar.data();
|
return sharedAvatar.data();
|
||||||
} else {
|
} else {
|
||||||
// we should remove this avatar, do that now
|
// we should remove this avatar, but we might not be on a thread that is allowed
|
||||||
erase(avatarIterator);
|
// so we just return NULL to the caller
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
++avatarIterator;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// return false, no match
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue