diff --git a/src/xrt/auxiliary/math/m_relation_history.cpp b/src/xrt/auxiliary/math/m_relation_history.cpp index 72f1f7e31..0bc21b290 100644 --- a/src/xrt/auxiliary/math/m_relation_history.cpp +++ b/src/xrt/auxiliary/math/m_relation_history.cpp @@ -236,8 +236,9 @@ m_relation_history_get_latest(struct m_relation_history *rh, } uint32_t -m_relation_history_get_size(const struct m_relation_history *rh) +m_relation_history_get_size(struct m_relation_history *rh) { + std::unique_lock lock(rh->mutex); return (uint32_t)rh->impl.size(); } diff --git a/src/xrt/auxiliary/math/m_relation_history.h b/src/xrt/auxiliary/math/m_relation_history.h index 3e6e84def..897c2765c 100644 --- a/src/xrt/auxiliary/math/m_relation_history.h +++ b/src/xrt/auxiliary/math/m_relation_history.h @@ -109,7 +109,7 @@ m_relation_history_get_latest(struct m_relation_history *rh, * @public @memberof m_relation_history */ uint32_t -m_relation_history_get_size(const struct m_relation_history *rh); +m_relation_history_get_size(struct m_relation_history *rh); /*! * Clears the history from all of the items. @@ -199,7 +199,7 @@ public: * @copydoc m_relation_history_get_size */ size_t - size() const noexcept + size() noexcept { return m_relation_history_get_size(mPtr); }