fix: correct use-after-free race causing frequent SIGSEGV when using the toggle_color/depth services (#208)

* fix: correct use-after-free race causing frequent SIGSEGV when using the toggle_color/depth services

(cherry picked from commit 2d59a581a82b81088971dccda353b96a527ee681)

* fix: add interleave_frame_enable handling in toggleSensor

Introduce interleave_frame_enable variable to manage frame interleaving during sensor toggling.

Signed-off-by: obshenlanzhou <[email protected]>

---------

Signed-off-by: obshenlanzhou <[email protected]>
Co-authored-by: obshenlanzhou <[email protected]>
This commit is contained in:
Matthew Gabeler-Lee
2026-08-07 09:23:34 +08:00
committed by GitHub
co-authored by obshenlanzhou
parent 549965ccbc
commit f39a27fbc1
+5 -1
View File
@@ -1940,7 +1940,11 @@ bool OBCameraNode::toggleSensor(const stream_index_pair& stream_index, bool enab
std::string& msg) {
std::lock_guard<decltype(device_lock_)> lock(device_lock_);
try {
pipeline_->stop();
const bool interleave_frame_enable = interleave_frame_enable_;
stopStreams();
interleave_frame_enable_ = interleave_frame_enable;
stopColorFrameThreads();
clearColorFrameQueues();
enable_stream_[stream_index] = enabled;
setupProfiles();
startStreams();