Skip to content

Commit

Permalink
Extend the lifetime of waitables by holding onto the shared pointer.
Browse files Browse the repository at this point in the history
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 <clalancette@openrobotics.org>
  • Loading branch information
clalancette committed May 19, 2020
1 parent 0dd14ba commit b4f744a
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
}
}
Expand Down

0 comments on commit b4f744a

Please sign in to comment.