Skip to content

Commit

Permalink
PR #13369 from Nir-Az: fix seg fault
Browse files Browse the repository at this point in the history
  • Loading branch information
Nir-Az authored Sep 23, 2024
2 parents dbf4848 + 5da690a commit 9246b53
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/ds/d400/d400-device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,13 @@ namespace librealsense
using namespace ds;

std::vector<std::shared_ptr<platform::uvc_device>> depth_devices;
for (auto&& info : filter_by_mi(all_device_infos, 0)) // Filter just mi=0, DEPTH
auto depth_devs_info = filter_by_mi( all_device_infos, 0 );

if ( depth_devs_info.empty() )
{
throw backend_exception("cannot access depth sensor", RS2_EXCEPTION_TYPE_BACKEND);
}
for (auto&& info : depth_devs_info) // Filter just mi=0, DEPTH
depth_devices.push_back( get_backend()->create_uvc_device( info ) );

std::unique_ptr< frame_timestamp_reader > timestamp_reader_backup( new ds_timestamp_reader() );
Expand Down
5 changes: 5 additions & 0 deletions src/ds/d500/d500-color.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ namespace librealsense

std::vector<platform::uvc_device_info> color_devs_info = filter_by_mi(group.uvc_devices, 3);

if ( color_devs_info.empty() )
{
throw backend_exception("cannot access color sensor", RS2_EXCEPTION_TYPE_BACKEND);
}

std::unique_ptr< frame_timestamp_reader > ds_timestamp_reader_backup( new ds_timestamp_reader() );
std::unique_ptr<frame_timestamp_reader> ds_timestamp_reader_metadata(new ds_timestamp_reader_from_metadata(std::move(ds_timestamp_reader_backup)));

Expand Down
9 changes: 8 additions & 1 deletion src/ds/d500/d500-device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,14 @@ namespace librealsense
using namespace ds;

std::vector<std::shared_ptr<platform::uvc_device>> depth_devices;
for( auto & info : filter_by_mi( all_device_infos, 0 ) ) // Filter just mi=0, DEPTH
auto depth_devs_info = filter_by_mi( all_device_infos, 0 );

if ( depth_devs_info.empty() )
{
throw backend_exception("cannot access depth sensor", RS2_EXCEPTION_TYPE_BACKEND);
}

for( auto & info : depth_devs_info ) // Filter just mi=0, DEPTH
depth_devices.push_back( get_backend()->create_uvc_device( info ) );

std::unique_ptr< frame_timestamp_reader > timestamp_reader_backup( new ds_timestamp_reader() );
Expand Down

0 comments on commit 9246b53

Please sign in to comment.