fix: wait for diagnostic callback before cleanup

Replace the timed diagnostic cleanup wait with a blocking wait so the
diagnostic updater is not destroyed while force_update() is still running.

This prevents a use-after-free crash when device reset overlaps with
diagnostic publishing after a disconnect.
This commit is contained in:
slz
2026-06-12 17:15:48 +08:00
parent 8bbd735d08
commit 9126013267
+1 -2
View File
@@ -699,8 +699,7 @@ void OBCameraNode::clean() noexcept {
// Wait for any currently executing timer callbacks to complete
{
std::unique_lock<std::mutex> lk(diagnostic_mutex_);
diagnostic_cv_.wait_for(lk, std::chrono::milliseconds(100),
[this]() { return !diagnostic_running_; });
diagnostic_cv_.wait(lk, [this]() { return !diagnostic_running_; });
}
diagnostic_timer_.reset();
}