node_handle must be destroyed after client_handle to prevent memory leak (#1562) (#1565)

Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
This commit is contained in:
Tomoya Fujita 2021-02-28 00:03:32 +09:00 committed by GitHub
parent 8f2809df64
commit 47f21dab3d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -100,8 +100,9 @@ public:
rclcpp::Context::SharedPtr context_;
rclcpp::node_interfaces::NodeGraphInterface::WeakPtr node_graph_;
std::shared_ptr<rcl_action_client_t> client_handle{nullptr};
// node_handle must be destroyed after client_handle to prevent memory leak
std::shared_ptr<rcl_node_t> node_handle{nullptr};
std::shared_ptr<rcl_action_client_t> client_handle{nullptr};
rclcpp::Logger logger;
using ResponseCallback = std::function<void (std::shared_ptr<void> response)>;