Merge pull request #15342 from SamGondelman/material

Case 20513: Extra check to make sure we remove materials from MyAvatar
This commit is contained in:
Sam Gondelman 2019-04-05 17:18:37 -07:00 committed by GitHub
commit b12a0e5cce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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) {