diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index a5c426db41..bb7e57a7eb 100755 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -263,11 +263,13 @@ void MyAvatar::setDominantHand(const QString& hand) { } void MyAvatar::requestDisableHandTouch() { + std::lock_guard guard(_disableHandTouchMutex); _disableHandTouchCount++; emit shouldDisableHandTouchChanged(_disableHandTouchCount > 0); } void MyAvatar::requestEnableHandTouch() { + std::lock_guard guard(_disableHandTouchMutex); _disableHandTouchCount = std::max(_disableHandTouchCount - 1, 0); emit shouldDisableHandTouchChanged(_disableHandTouchCount > 0); } diff --git a/interface/src/avatar/MyAvatar.h b/interface/src/avatar/MyAvatar.h index 6a1b889f86..d3b9eef2de 100644 --- a/interface/src/avatar/MyAvatar.h +++ b/interface/src/avatar/MyAvatar.h @@ -1666,6 +1666,7 @@ private: // all poses are in sensor-frame std::map _controllerPoseMap; mutable std::mutex _controllerPoseMapMutex; + mutable std::mutex _disableHandTouchMutex; bool _centerOfGravityModelEnabled { true }; bool _hmdLeanRecenterEnabled { true }; @@ -1706,7 +1707,7 @@ private: bool _shouldLoadScripts { false }; bool _haveReceivedHeightLimitsFromDomain { false }; - std::atomic _disableHandTouchCount { 0 }; + int _disableHandTouchCount { 0 }; }; QScriptValue audioListenModeToScriptValue(QScriptEngine* engine, const AudioListenerMode& audioListenerMode);