File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -246,6 +246,16 @@ class QOSEventHandler : public QOSEventHandlerBase
246246 }
247247 }
248248
249+ ~QOSEventHandler ()
250+ {
251+ // Since the rmw event listener holds a reference to the
252+ // "on ready" callback, we need to clear it on destruction of this class.
253+ // This clearing is not needed for other rclcpp entities like pub/subs, since
254+ // they do own the underlying rmw entities, which are destroyed
255+ // on their rclcpp destructors, thus no risk of dangling pointers.
256+ clear_on_ready_callback ();
257+ }
258+
249259 // / Take data so that the callback cannot be scheduled again
250260 std::shared_ptr<void >
251261 take_data () override
Original file line number Diff line number Diff line change @@ -35,13 +35,6 @@ UnsupportedEventTypeException::UnsupportedEventTypeException(
3535
3636QOSEventHandlerBase::~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.
43- clear_on_ready_callback ();
44-
4538 if (rcl_event_fini (&event_handle_) != RCL_RET_OK) {
4639 RCUTILS_LOG_ERROR_NAMED (
4740 " rclcpp" ,
You can’t perform that action at this time.
0 commit comments