mirror of
https://github.com/orbbec/OrbbecSDK_ROS2.git
synced 2026-09-12 11:10:19 +08:00
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:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user