From b5394f51d2db04290e1cea07a080628a3d36e047 Mon Sep 17 00:00:00 2001 From: Timo Witte Date: Wed, 9 Sep 2026 22:46:46 +0200 Subject: [PATCH] h/mercury: Fix crash when hand tracker init fails HandTracking leaves pool, group and kinematic_hands uninitialized unless t_hand_tracking_sync_mercury_create() fully succeeds. If an exception is thrown while loading the ONNX models, create() deletes the partially built object and ~HandTracking() then calls optimizer_destroy() on the garbage kinematic_hands pointers (and releases group), which segfaults in free(). Initialize these members to nullptr so a partially constructed HandTracking is safe to destroy. Signed-off-by: Timo Witte Part-of: --- src/xrt/tracking/hand/mercury/hg_sync.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/xrt/tracking/hand/mercury/hg_sync.hpp b/src/xrt/tracking/hand/mercury/hg_sync.hpp index 51e36288f..f36c09d90 100644 --- a/src/xrt/tracking/hand/mercury/hg_sync.hpp +++ b/src/xrt/tracking/hand/mercury/hg_sync.hpp @@ -259,9 +259,9 @@ public: struct model_output_visualizers visualizers; - u_worker_thread_pool *pool; + u_worker_thread_pool *pool = nullptr; - u_worker_group *group; + u_worker_group *group = nullptr; float baseline = {}; @@ -275,7 +275,7 @@ public: enum u_logging_level log_level = U_LOGGING_INFO; - lm::KinematicHandLM *kinematic_hands[2]; + lm::KinematicHandLM *kinematic_hands[2] = {nullptr}; // These are produced by the keypoint estimator and consumed by the nonlinear optimizer // left hand, right hand THEN left view, right view -- 2.51.2