Skip to content

Commit 77d238a

Browse files
alsoraAlberto Soragna
authored andcommitted
fixes for rmw callbacks in qos_event class (ros2#2102)
Signed-off-by: Alberto Soragna <[email protected]>
1 parent 00d3b01 commit 77d238a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

rclcpp/src/rclcpp/qos_event.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ UnsupportedEventTypeException::UnsupportedEventTypeException(
3535

3636
QOSEventHandlerBase::~QOSEventHandlerBase()
3737
{
38+
// Since the rmw event listener holds a reference to
39+
// this callback, we need to clear it on destruction of this class.
40+
// This clearing is not needed for other rclcpp entities like pub/subs, since
41+
// they do own the underlying rmw entities, which are destroyed
42+
// on their rclcpp destructors, thus no risk of dangling pointers.
3843
clear_on_ready_callback();
3944

4045
if (rcl_event_fini(&event_handle_) != RCL_RET_OK) {

0 commit comments

Comments
 (0)