mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 14:24:22 +02:00
avoid shared_from_this while constructing
This commit is contained in:
parent
bf290c35be
commit
22af5b27ab
4 changed files with 9 additions and 0 deletions
|
@ -60,6 +60,7 @@ AvatarData::AvatarData() :
|
|||
setBodyPitch(0.0f);
|
||||
setBodyYaw(-90.0f);
|
||||
setBodyRoll(0.0f);
|
||||
_constructing = false;
|
||||
}
|
||||
|
||||
AvatarData::~AvatarData() {
|
||||
|
|
|
@ -85,6 +85,7 @@ EntityItem::EntityItem(const EntityItemID& entityItemID) :
|
|||
quint64 now = usecTimestampNow();
|
||||
_lastSimulated = now;
|
||||
_lastUpdated = now;
|
||||
_constructing = false;
|
||||
}
|
||||
|
||||
EntityItem::~EntityItem() {
|
||||
|
|
|
@ -32,6 +32,11 @@ SpatiallyNestablePointer SpatiallyNestable::getParentPointer() const {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
if (_constructing) {
|
||||
// we can't use shared_from_this yet, so stop here.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SpatiallyNestableConstPointer constThisPointer = shared_from_this();
|
||||
SpatiallyNestablePointer thisPointer = std::const_pointer_cast<SpatiallyNestable>(constThisPointer); // ermahgerd !!!
|
||||
|
||||
|
|
|
@ -82,6 +82,8 @@ public:
|
|||
NestableTypes::NestableType getNestableType() const { return _nestableType; }
|
||||
|
||||
protected:
|
||||
bool _constructing = true;
|
||||
|
||||
NestableTypes::NestableType _nestableType; // EntityItem or an AvatarData
|
||||
QUuid _id;
|
||||
QUuid _parentID; // what is this thing's transform relative to?
|
||||
|
|
Loading…
Reference in a new issue