Skip to content

Commit 35a5d6a

Browse files
authored
fixes for rmw callbacks in qos_event class (#2102)
Signed-off-by: Alberto Soragna <[email protected]>
1 parent 01b1924 commit 35a5d6a

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

rclcpp/include/rclcpp/qos_event.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,10 +214,11 @@ class QOSEventHandlerBase : public Waitable
214214
void
215215
set_on_new_event_callback(rcl_event_callback_t callback, const void * user_data);
216216

217-
rcl_event_t event_handle_;
218-
size_t wait_set_event_index_;
219217
std::recursive_mutex callback_mutex_;
220218
std::function<void(size_t)> on_new_event_callback_{nullptr};
219+
220+
rcl_event_t event_handle_;
221+
size_t wait_set_event_index_;
221222
};
222223

223224
template<typename EventCallbackT, typename ParentHandleT>

rclcpp/src/rclcpp/qos_event.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ QOSEventHandlerBase::~QOSEventHandlerBase()
4040
// This clearing is not needed for other rclcpp entities like pub/subs, since
4141
// they do own the underlying rmw entities, which are destroyed
4242
// on their rclcpp destructors, thus no risk of dangling pointers.
43-
if (on_new_event_callback_) {
44-
clear_on_ready_callback();
45-
}
43+
clear_on_ready_callback();
4644

4745
if (rcl_event_fini(&event_handle_) != RCL_RET_OK) {
4846
RCUTILS_LOG_ERROR_NAMED(

0 commit comments

Comments
 (0)