mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 17:14:59 +02:00
protect Base3DOverlay::_name with a mutex
This commit is contained in:
parent
03f51352aa
commit
69ae04ab09
2 changed files with 21 additions and 4 deletions
|
@ -238,7 +238,9 @@ void Base3DOverlay::setProperties(const QVariantMap& originalProperties) {
|
|||
*/
|
||||
QVariant Base3DOverlay::getProperty(const QString& property) {
|
||||
if (property == "name") {
|
||||
return _name;
|
||||
return _nameLock.resultWithReadLock<QString>([&] {
|
||||
return _name;
|
||||
}
|
||||
}
|
||||
if (property == "position" || property == "start" || property == "p1" || property == "point") {
|
||||
return vec3toVariant(getWorldPosition());
|
||||
|
@ -346,6 +348,20 @@ void Base3DOverlay::setVisible(bool visible) {
|
|||
notifyRenderVariableChange();
|
||||
}
|
||||
|
||||
QString Base3DOverlay::getName() const {
|
||||
return _nameLock.resultWithReadLock<QString>([&] {
|
||||
return QString("Overlay:") + _name;
|
||||
}
|
||||
}
|
||||
|
||||
void Base3DOverlay::setName(QString name) {
|
||||
_nameLock.withWriteLock([&] {
|
||||
_name = name;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
render::ItemKey Base3DOverlay::getKey() {
|
||||
auto builder = render::ItemKey::Builder(Overlay::getKey());
|
||||
|
||||
|
@ -364,4 +380,4 @@ render::ItemKey Base3DOverlay::getKey() {
|
|||
}
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,8 +29,8 @@ public:
|
|||
virtual OverlayID getOverlayID() const override { return OverlayID(getID().toString()); }
|
||||
void setOverlayID(OverlayID overlayID) override { setID(overlayID); }
|
||||
|
||||
virtual QString getName() const override { return QString("Overlay:") + _name; }
|
||||
void setName(QString name) { _name = name; }
|
||||
virtual QString getName() const override;
|
||||
void setName(QString name);
|
||||
|
||||
// getters
|
||||
virtual bool is3D() const override { return true; }
|
||||
|
@ -107,6 +107,7 @@ protected:
|
|||
mutable bool _renderVariableDirty { true };
|
||||
|
||||
QString _name;
|
||||
mutable ReadWriteLockable _nameLock;
|
||||
};
|
||||
|
||||
#endif // hifi_Base3DOverlay_h
|
||||
|
|
Loading…
Reference in a new issue