From 4c1c593bf46fe9dcadc4336b2859fdf3e8ac3247 Mon Sep 17 00:00:00 2001 From: BabbleBones Date: Wed, 27 Sep 2023 01:11:24 -0400 Subject: [PATCH] steamvr_lh: add frame mutex to prevent double free --- src/xrt/drivers/steamvr_lh/device.cpp | 1 + src/xrt/drivers/steamvr_lh/device.hpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/xrt/drivers/steamvr_lh/device.cpp b/src/xrt/drivers/steamvr_lh/device.cpp index 8d676560b..ab510bec5 100644 --- a/src/xrt/drivers/steamvr_lh/device.cpp +++ b/src/xrt/drivers/steamvr_lh/device.cpp @@ -372,6 +372,7 @@ ControllerDevice::set_haptic_handle(vr::VRInputComponentHandle_t handle) void Device::update_inputs() { + std::lock_guard lock(frame_mutex); ctx->maybe_run_frame(++current_frame); } diff --git a/src/xrt/drivers/steamvr_lh/device.hpp b/src/xrt/drivers/steamvr_lh/device.hpp index 8fc972130..fac636a42 100644 --- a/src/xrt/drivers/steamvr_lh/device.hpp +++ b/src/xrt/drivers/steamvr_lh/device.hpp @@ -87,6 +87,8 @@ private: std::vector binding_profiles_vec; uint64_t current_frame{0}; + std::mutex frame_mutex; + void init_chaperone(const std::string &steam_install); };