diff --git a/nav2_costmap_2d/plugins/inflation_layer.cpp b/nav2_costmap_2d/plugins/inflation_layer.cpp index 999d5d9481b..e91392de5bb 100644 --- a/nav2_costmap_2d/plugins/inflation_layer.cpp +++ b/nav2_costmap_2d/plugins/inflation_layer.cpp @@ -78,7 +78,8 @@ InflationLayer::InflationLayer() InflationLayer::~InflationLayer() { - node_.lock()->remove_on_set_parameters_callback(dyn_params_handler_.get()); + auto node = node_.lock(); + node->remove_on_set_parameters_callback(dyn_params_handler_.get()); dyn_params_handler_.reset(); delete access_; } diff --git a/nav2_costmap_2d/plugins/obstacle_layer.cpp b/nav2_costmap_2d/plugins/obstacle_layer.cpp index 38a6258e309..4e0001b66b5 100644 --- a/nav2_costmap_2d/plugins/obstacle_layer.cpp +++ b/nav2_costmap_2d/plugins/obstacle_layer.cpp @@ -62,7 +62,8 @@ namespace nav2_costmap_2d ObstacleLayer::~ObstacleLayer() { - node_.lock()->remove_on_set_parameters_callback(dyn_params_handler_.get()); + auto node = node_.lock(); + node->remove_on_set_parameters_callback(dyn_params_handler_.get()); dyn_params_handler_.reset(); for (auto & notifier : observation_notifiers_) { notifier.reset(); diff --git a/nav2_costmap_2d/plugins/static_layer.cpp b/nav2_costmap_2d/plugins/static_layer.cpp index ef011eaf65c..c6d74dcd0f8 100644 --- a/nav2_costmap_2d/plugins/static_layer.cpp +++ b/nav2_costmap_2d/plugins/static_layer.cpp @@ -112,7 +112,8 @@ StaticLayer::activate() void StaticLayer::deactivate() { - node_.lock()->remove_on_set_parameters_callback(dyn_params_handler_.get()); + auto node = node_.lock(); + node->remove_on_set_parameters_callback(dyn_params_handler_.get()); dyn_params_handler_.reset(); } diff --git a/nav2_costmap_2d/plugins/voxel_layer.cpp b/nav2_costmap_2d/plugins/voxel_layer.cpp index a99466e6339..139d524ba8e 100644 --- a/nav2_costmap_2d/plugins/voxel_layer.cpp +++ b/nav2_costmap_2d/plugins/voxel_layer.cpp @@ -116,7 +116,8 @@ void VoxelLayer::onInitialize() VoxelLayer::~VoxelLayer() { - node_.lock()->remove_on_set_parameters_callback(dyn_params_handler_.get()); + auto node = node_.lock(); + node->remove_on_set_parameters_callback(dyn_params_handler_.get()); dyn_params_handler_.reset(); } diff --git a/nav2_mppi_controller/src/parameters_handler.cpp b/nav2_mppi_controller/src/parameters_handler.cpp index c6fe7d85514..fd8680d0794 100644 --- a/nav2_mppi_controller/src/parameters_handler.cpp +++ b/nav2_mppi_controller/src/parameters_handler.cpp @@ -28,7 +28,8 @@ ParametersHandler::ParametersHandler( ParametersHandler::~ParametersHandler() { - node_.lock()->remove_on_set_parameters_callback(on_set_param_handler_.get()); + auto node = node_.lock(); + node->remove_on_set_parameters_callback(on_set_param_handler_.get()); on_set_param_handler_.reset(); } diff --git a/nav2_navfn_planner/src/navfn_planner.cpp b/nav2_navfn_planner/src/navfn_planner.cpp index b302552e7a1..db45cd0fe5d 100644 --- a/nav2_navfn_planner/src/navfn_planner.cpp +++ b/nav2_navfn_planner/src/navfn_planner.cpp @@ -115,7 +115,8 @@ NavfnPlanner::deactivate() RCLCPP_INFO( logger_, "Deactivating plugin %s of type NavfnPlanner", name_.c_str()); - node_.lock()->remove_on_set_parameters_callback(dyn_params_handler_.get()); + auto node = node_.lock(); + node->remove_on_set_parameters_callback(dyn_params_handler_.get()); dyn_params_handler_.reset(); } diff --git a/nav2_rotation_shim_controller/src/nav2_rotation_shim_controller.cpp b/nav2_rotation_shim_controller/src/nav2_rotation_shim_controller.cpp index 0489a672557..fc4b17d0544 100644 --- a/nav2_rotation_shim_controller/src/nav2_rotation_shim_controller.cpp +++ b/nav2_rotation_shim_controller/src/nav2_rotation_shim_controller.cpp @@ -124,7 +124,8 @@ void RotationShimController::deactivate() primary_controller_->deactivate(); - node_.lock()->remove_on_set_parameters_callback(dyn_params_handler_.get()); + auto node = node_.lock(); + node->remove_on_set_parameters_callback(dyn_params_handler_.get()); dyn_params_handler_.reset(); } diff --git a/nav2_smac_planner/src/smac_planner_2d.cpp b/nav2_smac_planner/src/smac_planner_2d.cpp index ee51bb813cb..bbdb1afe7c6 100644 --- a/nav2_smac_planner/src/smac_planner_2d.cpp +++ b/nav2_smac_planner/src/smac_planner_2d.cpp @@ -177,7 +177,8 @@ void SmacPlanner2D::deactivate() if (_costmap_downsampler) { _costmap_downsampler->on_deactivate(); } - _node.lock()->remove_on_set_parameters_callback(_dyn_params_handler.get()); + auto node = _node.lock(); + node->remove_on_set_parameters_callback(_dyn_params_handler.get()); _dyn_params_handler.reset(); } diff --git a/nav2_smac_planner/src/smac_planner_hybrid.cpp b/nav2_smac_planner/src/smac_planner_hybrid.cpp index 88ae63d4659..8dcd7204a5c 100644 --- a/nav2_smac_planner/src/smac_planner_hybrid.cpp +++ b/nav2_smac_planner/src/smac_planner_hybrid.cpp @@ -311,7 +311,8 @@ void SmacPlannerHybrid::deactivate() if (_costmap_downsampler) { _costmap_downsampler->on_deactivate(); } - _node.lock()->remove_on_set_parameters_callback(_dyn_params_handler.get()); + auto node=_node.lock(); + node->remove_on_set_parameters_callback(_dyn_params_handler.get()); _dyn_params_handler.reset(); } diff --git a/nav2_smac_planner/src/smac_planner_lattice.cpp b/nav2_smac_planner/src/smac_planner_lattice.cpp index 212e071f242..3e469874d20 100644 --- a/nav2_smac_planner/src/smac_planner_lattice.cpp +++ b/nav2_smac_planner/src/smac_planner_lattice.cpp @@ -250,7 +250,8 @@ void SmacPlannerLattice::deactivate() _expansions_publisher->on_deactivate(); _planned_footprints_publisher->on_deactivate(); } - _node.lock()->remove_on_set_parameters_callback(_dyn_params_handler.get()); + auto node=_node.lock(); + node->remove_on_set_parameters_callback(_dyn_params_handler.get()); _dyn_params_handler.reset(); } diff --git a/nav2_theta_star_planner/src/theta_star_planner.cpp b/nav2_theta_star_planner/src/theta_star_planner.cpp index c10cda5348e..1e4458877d8 100644 --- a/nav2_theta_star_planner/src/theta_star_planner.cpp +++ b/nav2_theta_star_planner/src/theta_star_planner.cpp @@ -86,7 +86,8 @@ void ThetaStarPlanner::activate() void ThetaStarPlanner::deactivate() { RCLCPP_INFO(logger_, "Deactivating plugin %s of type nav2_theta_star_planner", name_.c_str()); - parent_node_.lock()->remove_on_set_parameters_callback(dyn_params_handler_.get()); + auto node = parent_node_.lock(); + node->remove_on_set_parameters_callback(dyn_params_handler_.get()); dyn_params_handler_.reset(); }