From 36818f21dcb980595ccf300e2ad39ee66c5347ef Mon Sep 17 00:00:00 2001 From: Raul Sanchez-Mateos Lizano Date: Thu, 28 Jul 2022 20:14:51 +0200 Subject: [PATCH] Disable RTPSParticipantImpl after removing it from RTPSDomain participants list (#2892) * Refs #15312: Disable RTPSParticipantImpl after removing it from RTPSDomain participants list Signed-off-by: RaulSanchez * Refs #15312: Disable RTPSParticipant in correct place Signed-off-by: RaulSanchez --- src/cpp/rtps/RTPSDomain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cpp/rtps/RTPSDomain.cpp b/src/cpp/rtps/RTPSDomain.cpp index dc804291115..f2108080f95 100644 --- a/src/cpp/rtps/RTPSDomain.cpp +++ b/src/cpp/rtps/RTPSDomain.cpp @@ -247,7 +247,6 @@ bool RTPSDomain::removeRTPSParticipant( if (p != nullptr) { assert((p->mp_impl != nullptr) && "This participant has been previously invalidated"); - p->mp_impl->disable(); std::unique_lock lock(m_mutex); for (auto it = m_RTPSParticipants.begin(); it != m_RTPSParticipants.end(); ++it) @@ -270,6 +269,7 @@ bool RTPSDomain::removeRTPSParticipant( void RTPSDomain::removeRTPSParticipant_nts( RTPSDomain::t_p_RTPSParticipant& participant) { + participant.second->disable(); // The destructor of RTPSParticipantImpl already deletes the associated RTPSParticipant and sets // its pointer to the RTPSParticipant to nullptr, so there is no need to do it here manually. delete(participant.second);