mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 05:37:13 +02:00
fix entity parenting crash
This commit is contained in:
parent
8e3097d94c
commit
68fd9eafa8
2 changed files with 15 additions and 2 deletions
|
@ -1678,14 +1678,23 @@ void EntityTree::entityChanged(EntityItemPointer entity) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QVector<EntityItemWeakPointer> EntityTree::getEntitiesParentFixup() const {
|
||||||
|
QReadLocker locker(&_needsParentFixupLock);
|
||||||
|
return _needsParentFixup;
|
||||||
|
}
|
||||||
|
|
||||||
|
void EntityTree::setNeedsParentFixup(QVector<EntityItemWeakPointer> entitiesFixup) {
|
||||||
|
QWriteLocker locker(&_needsParentFixupLock);
|
||||||
|
_needsParentFixup = entitiesFixup;
|
||||||
|
}
|
||||||
|
|
||||||
void EntityTree::fixupNeedsParentFixups() {
|
void EntityTree::fixupNeedsParentFixups() {
|
||||||
PROFILE_RANGE(simulation_physics, "FixupParents");
|
PROFILE_RANGE(simulation_physics, "FixupParents");
|
||||||
MovingEntitiesOperator moveOperator;
|
MovingEntitiesOperator moveOperator;
|
||||||
|
|
||||||
QWriteLocker locker(&_needsParentFixupLock);
|
QVector<EntityItemWeakPointer> entitiesParentFixup = getEntitiesParentFixup();
|
||||||
|
|
||||||
QMutableVectorIterator<EntityItemWeakPointer> iter(_needsParentFixup);
|
QMutableVectorIterator<EntityItemWeakPointer> iter(entitiesParentFixup);
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
EntityItemWeakPointer entityWP = iter.next();
|
EntityItemWeakPointer entityWP = iter.next();
|
||||||
EntityItemPointer entity = entityWP.lock();
|
EntityItemPointer entity = entityWP.lock();
|
||||||
|
@ -1748,6 +1757,8 @@ void EntityTree::fixupNeedsParentFixups() {
|
||||||
PerformanceTimer perfTimer("recurseTreeWithOperator");
|
PerformanceTimer perfTimer("recurseTreeWithOperator");
|
||||||
recurseTreeWithOperator(&moveOperator);
|
recurseTreeWithOperator(&moveOperator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setNeedsParentFixup(entitiesParentFixup);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityTree::deleteDescendantsOfAvatar(QUuid avatarID) {
|
void EntityTree::deleteDescendantsOfAvatar(QUuid avatarID) {
|
||||||
|
|
|
@ -385,6 +385,8 @@ private:
|
||||||
void sendChallengeOwnershipPacket(const QString& certID, const QString& ownerKey, const EntityItemID& entityItemID, const SharedNodePointer& senderNode);
|
void sendChallengeOwnershipPacket(const QString& certID, const QString& ownerKey, const EntityItemID& entityItemID, const SharedNodePointer& senderNode);
|
||||||
void sendChallengeOwnershipRequestPacket(const QByteArray& certID, const QByteArray& text, const QByteArray& nodeToChallenge, const SharedNodePointer& senderNode);
|
void sendChallengeOwnershipRequestPacket(const QByteArray& certID, const QByteArray& text, const QByteArray& nodeToChallenge, const SharedNodePointer& senderNode);
|
||||||
void validatePop(const QString& certID, const EntityItemID& entityItemID, const SharedNodePointer& senderNode, bool isRetryingValidation);
|
void validatePop(const QString& certID, const EntityItemID& entityItemID, const SharedNodePointer& senderNode, bool isRetryingValidation);
|
||||||
|
QVector<EntityItemWeakPointer> getEntitiesParentFixup() const;
|
||||||
|
void setNeedsParentFixup(QVector<EntityItemWeakPointer> entitiesFixup);
|
||||||
|
|
||||||
std::shared_ptr<AvatarData> _myAvatar{ nullptr };
|
std::shared_ptr<AvatarData> _myAvatar{ nullptr };
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue