From d06e8e08545d93c905a5d9591c4f1fc26a77268e Mon Sep 17 00:00:00 2001 From: Jacob Perron Date: Wed, 20 May 2020 18:42:31 -0700 Subject: [PATCH] Log debug messages when dropping a weak references to goal handles Signed-off-by: Jacob Perron --- rclcpp_action/include/rclcpp_action/client.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/rclcpp_action/include/rclcpp_action/client.hpp b/rclcpp_action/include/rclcpp_action/client.hpp index 1ee5e1b972..54562a608b 100644 --- a/rclcpp_action/include/rclcpp_action/client.hpp +++ b/rclcpp_action/include/rclcpp_action/client.hpp @@ -396,6 +396,9 @@ class Client : public ClientBase auto goal_handle_it = goal_handles_.begin(); while (goal_handle_it != goal_handles_.end()) { if (!goal_handle_it->second.lock()) { + RCLCPP_DEBUG( + this->get_logger(), + "Dropping weak reference to goal handle during send_goal()"); goal_handle_it = goal_handles_.erase(goal_handle_it); } else { ++goal_handle_it; @@ -569,6 +572,9 @@ class Client : public ClientBase typename GoalHandle::SharedPtr goal_handle = goal_handles_[goal_id].lock(); // Forget about the goal if there are no more user references if (!goal_handle) { + RCLCPP_DEBUG( + this->get_logger(), + "Dropping weak reference to goal handle during feedback callback"); goal_handles_.erase(goal_id); return; } @@ -603,6 +609,9 @@ class Client : public ClientBase typename GoalHandle::SharedPtr goal_handle = goal_handles_[goal_id].lock(); // Forget about the goal if there are no more user references if (!goal_handle) { + RCLCPP_DEBUG( + this->get_logger(), + "Dropping weak reference to goal handle during status callback"); goal_handles_.erase(goal_id); continue; }