diff --git a/rmw_fastrtps_cpp/src/rmw_service.cpp b/rmw_fastrtps_cpp/src/rmw_service.cpp index 220fe26a0..ee066e709 100644 --- a/rmw_fastrtps_cpp/src/rmw_service.cpp +++ b/rmw_fastrtps_cpp/src/rmw_service.cpp @@ -245,7 +245,7 @@ rmw_create_service( delete info->pub_listener_; } }); - info->pub_listener_ = new (std::nothrow) ServicePubListener(info); + info->pub_listener_ = new (std::nothrow) ServicePubListener(); if (!info->pub_listener_) { RMW_SET_ERROR_MSG("failed to create service response publisher listener"); return nullptr; diff --git a/rmw_fastrtps_dynamic_cpp/src/rmw_service.cpp b/rmw_fastrtps_dynamic_cpp/src/rmw_service.cpp index 8234e8ab7..11e06a343 100644 --- a/rmw_fastrtps_dynamic_cpp/src/rmw_service.cpp +++ b/rmw_fastrtps_dynamic_cpp/src/rmw_service.cpp @@ -235,7 +235,7 @@ rmw_create_service( RMW_SET_ERROR_MSG("failed to get datawriter qos"); goto fail; } - info->pub_listener_ = new ServicePubListener(info); + info->pub_listener_ = new ServicePubListener(); info->response_publisher_ = Domain::createPublisher(participant, publisherParam, info->pub_listener_); if (!info->response_publisher_) { diff --git a/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/custom_service_info.hpp b/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/custom_service_info.hpp index 4e43cd28b..7e68c2f29 100644 --- a/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/custom_service_info.hpp +++ b/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/custom_service_info.hpp @@ -82,11 +82,7 @@ class ServicePubListener : public eprosima::fastrtps::PublisherListener rmw_fastrtps_shared_cpp::hash_fastrtps_guid>; public: - explicit ServicePubListener(CustomServiceInfo * info) - : info_(info) - { - (void)info_; - } + ServicePubListener() = default; void onPublicationMatched( @@ -149,7 +145,6 @@ class ServicePubListener : public eprosima::fastrtps::PublisherListener } private: - CustomServiceInfo * info_; std::mutex mutex_; subscriptions_set_t subscriptions_ RCPPUTILS_TSA_GUARDED_BY(mutex_); clients_endpoints_map_t clients_endpoints_ RCPPUTILS_TSA_GUARDED_BY(mutex_);