Skip to content

Commit

Permalink
Disable RTPSParticipantImpl after removing it from RTPSDomain partici…
Browse files Browse the repository at this point in the history
…pants list (#2892)

* Refs #15312: Disable RTPSParticipantImpl after removing it from RTPSDomain participants list

Signed-off-by: RaulSanchez <raul@eprosima.com>

* Refs #15312: Disable RTPSParticipant in correct place

Signed-off-by: RaulSanchez <raul@eprosima.com>
  • Loading branch information
rsanchez15 authored Jul 28, 2022
1 parent 51f8511 commit 36818f2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/cpp/rtps/RTPSDomain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::mutex> lock(m_mutex);
for (auto it = m_RTPSParticipants.begin(); it != m_RTPSParticipants.end(); ++it)
Expand All @@ -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);
Expand Down

0 comments on commit 36818f2

Please sign in to comment.