From b4f744a2ecbeb51133bd4e4fc61ad893cd4e71fe Mon Sep 17 00:00:00 2001 From: Chris Lalancette Date: Tue, 19 May 2020 17:46:02 +0000 Subject: [PATCH] Extend the lifetime of waitables by holding onto the shared pointer. Otherwise, you can get into a situation where the waitable has actually been freed before you try to access it later. Signed-off-by: Chris Lalancette --- rclcpp/include/rclcpp/strategies/allocator_memory_strategy.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rclcpp/include/rclcpp/strategies/allocator_memory_strategy.hpp b/rclcpp/include/rclcpp/strategies/allocator_memory_strategy.hpp index 4cad8d548b..5f85fb8523 100644 --- a/rclcpp/include/rclcpp/strategies/allocator_memory_strategy.hpp +++ b/rclcpp/include/rclcpp/strategies/allocator_memory_strategy.hpp @@ -187,7 +187,7 @@ class AllocatorMemoryStrategy : public memory_strategy::MemoryStrategy group->find_waitable_ptrs_if( [this](const rclcpp::Waitable::SharedPtr & waitable) { waitable_handles_.push_back(waitable); - return false; + return true; }); } }