Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coverity - Uncaught exception #12489

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/callback-invocation.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,17 @@ struct callback_invocation_holder

~callback_invocation_holder()
{
if( invocation )
owner->deallocate( invocation );
if (invocation)
OhadMeir marked this conversation as resolved.
Show resolved Hide resolved
{
try
{
owner->deallocate(invocation);
}
catch (...)
OhadMeir marked this conversation as resolved.
Show resolved Hide resolved
{
LOG_DEBUG("Error while callback holder deallocation");
}
}
}

callback_invocation_holder & operator=( callback_invocation_holder && other )
Expand Down
13 changes: 10 additions & 3 deletions src/gl/align-gl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,15 @@ align_gl::align_gl(rs2_stream to_stream) : align(to_stream, "Align (GLSL)")

align_gl::~align_gl()
{
perform_gl_action([&]()
try
{
cleanup_gpu_resources();
}, []{});
perform_gl_action([&]()
{
cleanup_gpu_resources();
}, [] {});
}
catch (...)
{
LOG_DEBUG("Error while cleaning up gpu resources");
}
}
13 changes: 10 additions & 3 deletions src/gl/colorizer-gl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,17 @@ namespace librealsense

colorizer::~colorizer()
{
perform_gl_action([&]()
try
{
perform_gl_action([&]()
{
cleanup_gpu_resources();
}, [] {});
}
catch (...)
{
cleanup_gpu_resources();
}, []{});
LOG_DEBUG("Error while performing cleaning up gpu resources");
}
}

void colorizer::populate_floating_histogram(float* f, int* hist)
Expand Down
13 changes: 10 additions & 3 deletions src/gl/pointcloud-gl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,10 +388,17 @@ void pointcloud_gl::create_gpu_resources()

pointcloud_gl::~pointcloud_gl()
{
perform_gl_action([&]()
try
{
cleanup_gpu_resources();
}, []{});
perform_gl_action([&]()
{
cleanup_gpu_resources();
}, [] {});
}
catch (...)
{
LOG_DEBUG("Error while cleaning up gpu resources");
}
}

pointcloud_gl::pointcloud_gl()
Expand Down
13 changes: 10 additions & 3 deletions src/gl/synthetic-stream-gl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,16 @@ namespace librealsense
gpu_section::~gpu_section()
{
backup_content = false;
perform_gl_action([&](){
cleanup_gpu_resources();
}, []{});
try
{
perform_gl_action([&]() {
cleanup_gpu_resources();
}, [] {});
}
catch (...)
{
LOG_DEBUG("Error while cleaning up gpu resources");
}
}

void gpu_section::create_gpu_resources()
Expand Down
13 changes: 10 additions & 3 deletions src/gl/upload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,17 @@ namespace librealsense

upload::~upload()
{
perform_gl_action([&]()
try
{
cleanup_gpu_resources();
}, [] {});
perform_gl_action([&]()
{
cleanup_gpu_resources();
}, [] {});
}
catch (...)
{
LOG_DEBUG("Error while cleaning up gpu resources");
}
}

void upload::cleanup_gpu_resources()
Expand Down
13 changes: 10 additions & 3 deletions src/gl/y4112rgb-gl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,17 @@ y411_2rgb::y411_2rgb()

y411_2rgb::~y411_2rgb()
{
perform_gl_action([&]()
try
{
perform_gl_action([&]()
{
cleanup_gpu_resources();
}, [] {});
}
catch (...)
{
cleanup_gpu_resources();
}, []{});
LOG_DEBUG("Error while cleaning up gpu resources");
}
}

rs2::frame y411_2rgb::process_frame(const rs2::frame_source& src, const rs2::frame& f)
Expand Down
13 changes: 10 additions & 3 deletions src/gl/yuy2rgb-gl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,17 @@ yuy2rgb::yuy2rgb()

yuy2rgb::~yuy2rgb()
{
perform_gl_action([&]()
try
{
perform_gl_action([&]()
{
cleanup_gpu_resources();
}, [] {});
}
catch (...)
{
cleanup_gpu_resources();
}, []{});
LOG_DEBUG("Error while cleaning up gpu resources");
}
}

rs2::frame yuy2rgb::process_frame(const rs2::frame_source& src, const rs2::frame& f)
Expand Down
9 changes: 8 additions & 1 deletion src/hw-monitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,14 @@ namespace librealsense

~locked_transfer()
{
_heap.wait_until_empty();
try
{
_heap.wait_until_empty();
}
catch (...)
{
LOG_DEBUG("Error while waiting for an empty heap");
}
}
private:
std::shared_ptr<platform::command_transfer> _command_transfer;
Expand Down
18 changes: 16 additions & 2 deletions src/linux/backend-hid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,14 @@ namespace librealsense

hid_input::~hid_input()
{
enable(false);
try
{
enable(false);
}
catch (...)
{
LOG_DEBUG("Error while enabling a hid device");
OhadMeir marked this conversation as resolved.
Show resolved Hide resolved
}
}

// enable scan input. doing so cause the input to be part of the data provided in the polling.
Expand Down Expand Up @@ -954,7 +961,14 @@ namespace librealsense
{
for (auto& elem : _streaming_iio_sensors)
{
elem->stop_capture();
try
{
elem->stop_capture();
}
catch (...)
{
LOG_DEBUG("Error while stopping capture sensor");
}
}

for (auto& elem : _streaming_custom_sensors)
Expand Down
9 changes: 8 additions & 1 deletion src/linux/backend-v4l2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,14 @@ namespace librealsense

named_mutex::~named_mutex()
{
unlock();
try
{
unlock();
}
catch (...)
{
LOG_DEBUG("Error while unlocking mutex");
}
}

void named_mutex::lock()
Expand Down
10 changes: 8 additions & 2 deletions src/linux/udev-device-watcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,14 @@ udev_device_watcher::udev_device_watcher( const platform::backend * backend )

udev_device_watcher::~udev_device_watcher()
{
stop();

try
{
stop();
}
catch (...)
{
LOG_DEBUG("Error while stopping udev device watcher");
}
/* Release the udev monitor */
if( _udev_monitor )
udev_monitor_unref( _udev_monitor );
Expand Down
9 changes: 8 additions & 1 deletion src/sync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,14 @@ namespace librealsense
LOG_WARNING(callbacks_inflight << " callbacks are still running on some other threads. Waiting until all callbacks return...");
}
// wait until user is done with all the stuff he chose to borrow
_callback_inflight.wait_until_empty();
try
{
_callback_inflight.wait_until_empty();
}
catch (...)
{
LOG_DEBUG("Error while waiting for an empty callback");
OhadMeir marked this conversation as resolved.
Show resolved Hide resolved
}
}

identity_matcher::identity_matcher(stream_id stream, rs2_stream stream_type)
Expand Down
Loading