mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 16:41:57 +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);
|
setBodyPitch(0.0f);
|
||||||
setBodyYaw(-90.0f);
|
setBodyYaw(-90.0f);
|
||||||
setBodyRoll(0.0f);
|
setBodyRoll(0.0f);
|
||||||
|
_constructing = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
AvatarData::~AvatarData() {
|
AvatarData::~AvatarData() {
|
||||||
|
|
|
@ -85,6 +85,7 @@ EntityItem::EntityItem(const EntityItemID& entityItemID) :
|
||||||
quint64 now = usecTimestampNow();
|
quint64 now = usecTimestampNow();
|
||||||
_lastSimulated = now;
|
_lastSimulated = now;
|
||||||
_lastUpdated = now;
|
_lastUpdated = now;
|
||||||
|
_constructing = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityItem::~EntityItem() {
|
EntityItem::~EntityItem() {
|
||||||
|
|
|
@ -32,6 +32,11 @@ SpatiallyNestablePointer SpatiallyNestable::getParentPointer() const {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_constructing) {
|
||||||
|
// we can't use shared_from_this yet, so stop here.
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
SpatiallyNestableConstPointer constThisPointer = shared_from_this();
|
SpatiallyNestableConstPointer constThisPointer = shared_from_this();
|
||||||
SpatiallyNestablePointer thisPointer = std::const_pointer_cast<SpatiallyNestable>(constThisPointer); // ermahgerd !!!
|
SpatiallyNestablePointer thisPointer = std::const_pointer_cast<SpatiallyNestable>(constThisPointer); // ermahgerd !!!
|
||||||
|
|
||||||
|
|
|
@ -82,6 +82,8 @@ public:
|
||||||
NestableTypes::NestableType getNestableType() const { return _nestableType; }
|
NestableTypes::NestableType getNestableType() const { return _nestableType; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
bool _constructing = true;
|
||||||
|
|
||||||
NestableTypes::NestableType _nestableType; // EntityItem or an AvatarData
|
NestableTypes::NestableType _nestableType; // EntityItem or an AvatarData
|
||||||
QUuid _id;
|
QUuid _id;
|
||||||
QUuid _parentID; // what is this thing's transform relative to?
|
QUuid _parentID; // what is this thing's transform relative to?
|
||||||
|
|
Loading…
Reference in a new issue