extra check to make sure we remove material from MyAvatar

This commit is contained in:
SamGondelman 2019-04-05 16:22:16 -07:00
parent fd245b61ab
commit 924bf53698
2 changed files with 10 additions and 3 deletions

View file

@ -229,8 +229,9 @@ AvatarSharedPointer AvatarHashMap::newOrExistingAvatar(const QUuid& sessionUUID,
AvatarSharedPointer AvatarHashMap::findAvatar(const QUuid& sessionUUID) const {
QReadLocker locker(&_hashLock);
if (_avatarHash.contains(sessionUUID)) {
return _avatarHash.value(sessionUUID);
auto avatarIter = _avatarHash.find(sessionUUID);
if (avatarIter != _avatarHash.end()) {
return avatarIter.value();
}
return nullptr;
}

View file

@ -358,7 +358,13 @@ void MaterialEntityRenderer::deleteMaterial(const QUuid& oldParentID, const QStr
return;
}
// if a remove fails, our parent is gone, so we don't need to retry
// if a remove fails, our parent is gone, so we don't need to retry, EXCEPT:
// MyAvatar can change UUIDs when you switch domains, which leads to a timing issue. Let's just make
// sure we weren't attached to MyAvatar by trying this (if we weren't, this will have no effect)
if (EntityTreeRenderer::removeMaterialFromAvatar(AVATAR_SELF_ID, material, oldParentMaterialNameStd)) {
_appliedMaterial = nullptr;
return;
}
}
void MaterialEntityRenderer::applyTextureTransform(std::shared_ptr<NetworkMaterial>& material) {