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

Guard callbackImage to avoid segfault #58

Open
wants to merge 2 commits into
base: foxy-devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions include/rqt_image_view/image_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ protected slots:
int num_gridlines_;

RotateState rotate_state_;

bool shutting_down_;
};

}
Expand Down
6 changes: 6 additions & 0 deletions src/rqt_image_view/image_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ ImageView::ImageView()
, widget_(0)
, num_gridlines_(0)
, rotate_state_(ROTATE_0)
, shutting_down_(false)
{
setObjectName("ImageView");
}
Expand Down Expand Up @@ -123,6 +124,7 @@ void ImageView::initPlugin(qt_gui_cpp::PluginContext& context)

void ImageView::shutdownPlugin()
{
shutting_down_ = true;
subscriber_.shutdown();
pub_mouse_left_.reset();
}
Expand Down Expand Up @@ -538,6 +540,10 @@ void ImageView::overlayGrid()

void ImageView::callbackImage(const sensor_msgs::msg::Image::ConstSharedPtr& msg)
{
if (shutting_down_) {
return;
}

try
{
// First let cv_bridge do its magic
Expand Down