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);