Skip to content

Commit

Permalink
Merge pull request eProsima#134 from dhood/set_parameter_if_not_set_c…
Browse files Browse the repository at this point in the history
…rashes

Prevent onNewCacheChangeAdded from being called after ReaderLister has been destroyed
  • Loading branch information
richiware authored Aug 21, 2017
2 parents 36fe346 + 2f3e689 commit af42b6e
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,10 @@ void EDPSimplePUBListener::onNewCacheChangeAdded(RTPSReader* /*reader*/, const C
}

//Call the slave, if it exists
attached_listener_mutex.lock();
if(attached_listener != nullptr)
attached_listener->onNewCacheChangeAdded(this->mp_SEDP->mp_PubReader.first, change_in);
attached_listener_mutex.unlock();
}
}
else
Expand All @@ -108,8 +110,10 @@ void EDPSimplePUBListener::onNewCacheChangeAdded(RTPSReader* /*reader*/, const C
logInfo(RTPS_EDP,"Disposed Remote Writer, removing...");

//Call the slave, if it exists
attached_listener_mutex.lock();
if(attached_listener != nullptr)
attached_listener->onNewCacheChangeAdded(this->mp_SEDP->mp_PubReader.first, change_in);
attached_listener_mutex.unlock();

GUID_t auxGUID = iHandle2GUID(change->instanceHandle);
this->mp_SEDP->removeWriterProxy(auxGUID);
Expand Down Expand Up @@ -233,8 +237,10 @@ void EDPSimpleSUBListener::onNewCacheChangeAdded(RTPSReader* /*reader*/, const C
}

//Call the slave, if it exists
attached_listener_mutex.lock();
if(attached_listener != nullptr)
attached_listener->onNewCacheChangeAdded(this->mp_SEDP->mp_SubReader.first, change);
attached_listener_mutex.unlock();
}
}
else
Expand All @@ -243,8 +249,10 @@ void EDPSimpleSUBListener::onNewCacheChangeAdded(RTPSReader* /*reader*/, const C
logInfo(RTPS_EDP,"Disposed Remote Reader, removing...");

//Call the slave, if it exists
attached_listener_mutex.lock();
if(attached_listener != nullptr)
attached_listener->onNewCacheChangeAdded(this->mp_SEDP->mp_SubReader.first, change);
attached_listener_mutex.unlock();

GUID_t auxGUID = iHandle2GUID(change->instanceHandle);
this->mp_SEDP->removeReaderProxy(auxGUID);
Expand Down

0 comments on commit af42b6e

Please sign in to comment.