fix for recursive write then read lock

This commit is contained in:
Stephen Birarda 2015-11-19 15:35:41 -08:00
parent 2a05ec650b
commit 5140a480a1
3 changed files with 15 additions and 21 deletions

View file

@ -1187,7 +1187,7 @@ void Avatar::computeShapeInfo(ShapeInfo& shapeInfo) {
// virtual // virtual
void Avatar::rebuildSkeletonBody() { void Avatar::rebuildSkeletonBody() {
DependencyManager::get<AvatarManager>()->updateAvatarPhysicsShape(getSessionUUID()); DependencyManager::get<AvatarManager>()->updateAvatarPhysicsShape(this);
} }
glm::vec3 Avatar::getLeftPalmPosition() { glm::vec3 Avatar::getLeftPalmPosition() {

View file

@ -328,25 +328,19 @@ void AvatarManager::handleCollisionEvents(const CollisionEvents& collisionEvents
} }
} }
void AvatarManager::updateAvatarPhysicsShape(const QUuid& id) { void AvatarManager::updateAvatarPhysicsShape(Avatar* avatar) {
auto avatarData = findAvatar(id); AvatarMotionState* motionState = avatar->getMotionState();
if (motionState) {
if (avatarData) { motionState->addDirtyFlags(Simulation::DIRTY_SHAPE);
auto avatar = std::dynamic_pointer_cast<Avatar>(avatarData); } else {
ShapeInfo shapeInfo;
AvatarMotionState* motionState = avatar->getMotionState(); avatar->computeShapeInfo(shapeInfo);
if (motionState) { btCollisionShape* shape = ObjectMotionState::getShapeManager()->getShape(shapeInfo);
motionState->addDirtyFlags(Simulation::DIRTY_SHAPE); if (shape) {
} else { AvatarMotionState* motionState = new AvatarMotionState(avatar, shape);
ShapeInfo shapeInfo; avatar->setMotionState(motionState);
avatar->computeShapeInfo(shapeInfo); _motionStatesToAdd.insert(motionState);
btCollisionShape* shape = ObjectMotionState::getShapeManager()->getShape(shapeInfo); _avatarMotionStates.insert(motionState);
if (shape) {
AvatarMotionState* motionState = new AvatarMotionState(avatar.get(), shape);
avatar->setMotionState(motionState);
_motionStatesToAdd.insert(motionState);
_avatarMotionStates.insert(motionState);
}
} }
} }
} }

View file

@ -63,7 +63,7 @@ public:
void handleOutgoingChanges(const VectorOfMotionStates& motionStates); void handleOutgoingChanges(const VectorOfMotionStates& motionStates);
void handleCollisionEvents(const CollisionEvents& collisionEvents); void handleCollisionEvents(const CollisionEvents& collisionEvents);
void updateAvatarPhysicsShape(const QUuid& id); void updateAvatarPhysicsShape(Avatar* avatar);
public slots: public slots:
void setShouldShowReceiveStats(bool shouldShowReceiveStats) { _shouldShowReceiveStats = shouldShowReceiveStats; } void setShouldShowReceiveStats(bool shouldShowReceiveStats) { _shouldShowReceiveStats = shouldShowReceiveStats; }