rclcpp
rclcpp copied to clipboard
Add weak_ptr<void> callback_lifetime to SubscriptionOptions
Avoid potential use after free usage of a registered subscription callback function by allowing user to specify a weak_ptr to be checked for expiry before the associated subscription callback is called.
If user does not specify callback_lifetime, the mechanism falls back to a tracking the lifetime of a user specified callback_group, failing that it tracks the lifetime of the nodes default_callback_group.