Skip to content

Commit

Permalink
Avoid crash on shutdown (#179)
Browse files Browse the repository at this point in the history
* stop shutdown_costmap_timer on destructor
* explicitly call costmap_nav_srv destructor
  • Loading branch information
corot authored Apr 7, 2020
2 parents a784ac6 + 4d34e79 commit 0453b60
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions mbf_costmap_nav/src/mbf_costmap_nav/costmap_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ CostmapWrapper::CostmapWrapper(const std::string &name, const TFPtr &tf_listener

CostmapWrapper::~CostmapWrapper()
{
shutdown_costmap_timer_.stop();
}


Expand Down
4 changes: 4 additions & 0 deletions mbf_costmap_nav/src/move_base_server_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,9 @@ int main(int argc, char **argv)
#endif
costmap_nav_srv_ptr = boost::make_shared<mbf_costmap_nav::CostmapNavigationServer>(tf_listener_ptr);
ros::spin();

// explicitly call destructor here, otherwise costmap_nav_srv_ptr will be
// destructed after tearing down internally allocated static variables
costmap_nav_srv_ptr.reset();
return EXIT_SUCCESS;
}

0 comments on commit 0453b60

Please sign in to comment.