@@ -1350,7 +1350,7 @@ bool RTPSParticipantImpl::createReader(
1350
1350
return create_reader (ReaderOut, param, entityId, isBuiltin, enable, callback);
1351
1351
}
1352
1352
1353
- BaseReader* RTPSParticipantImpl::find_local_reader (
1353
+ std::shared_ptr<LocalReaderPointer> RTPSParticipantImpl::find_local_reader (
1354
1354
const GUID_t& reader_guid)
1355
1355
{
1356
1356
shared_lock<shared_mutex> _ (endpoints_list_mutex);
@@ -1359,11 +1359,11 @@ BaseReader* RTPSParticipantImpl::find_local_reader(
1359
1359
{
1360
1360
if (reader->getGuid () == reader_guid)
1361
1361
{
1362
- return reader;
1362
+ return reader-> get_local_pointer () ;
1363
1363
}
1364
1364
}
1365
1365
1366
- return nullptr ;
1366
+ return std::shared_ptr<LocalReaderPointer>() ;
1367
1367
}
1368
1368
1369
1369
BaseWriter* RTPSParticipantImpl::find_local_writer (
@@ -1960,6 +1960,7 @@ bool RTPSParticipantImpl::deleteUserEndpoint(
1960
1960
1961
1961
bool found = false , found_in_users = false ;
1962
1962
Endpoint* p_endpoint = nullptr ;
1963
+ BaseReader* reader = nullptr ;
1963
1964
1964
1965
if (endpoint.entityId .is_writer ())
1965
1966
{
@@ -1994,6 +1995,7 @@ bool RTPSParticipantImpl::deleteUserEndpoint(
1994
1995
{
1995
1996
if ((*rit)->getGuid ().entityId == endpoint.entityId ) // Found it
1996
1997
{
1998
+ reader = *rit;
1997
1999
m_userReaderList.erase (rit);
1998
2000
found_in_users = true ;
1999
2001
break ;
@@ -2004,6 +2006,7 @@ bool RTPSParticipantImpl::deleteUserEndpoint(
2004
2006
{
2005
2007
if ((*rit)->getGuid ().entityId == endpoint.entityId ) // Found it
2006
2008
{
2009
+ reader = *rit;
2007
2010
p_endpoint = *rit;
2008
2011
m_allReaderList.erase (rit);
2009
2012
found = true ;
@@ -2062,6 +2065,10 @@ bool RTPSParticipantImpl::deleteUserEndpoint(
2062
2065
#endif // if HAVE_SECURITY
2063
2066
}
2064
2067
2068
+ if (reader)
2069
+ {
2070
+ reader->local_actions_on_reader_removed ();
2071
+ }
2065
2072
delete (p_endpoint);
2066
2073
return true ;
2067
2074
}
@@ -2149,6 +2156,11 @@ void RTPSParticipantImpl::deleteAllUserEndpoints()
2149
2156
}
2150
2157
#endif // if HAVE_SECURITY
2151
2158
2159
+ if (kind == READER)
2160
+ {
2161
+ static_cast <BaseReader*>(endpoint)->local_actions_on_reader_removed ();
2162
+ }
2163
+
2152
2164
// remove the endpoints
2153
2165
delete (endpoint);
2154
2166
}
@@ -2837,8 +2849,11 @@ bool RTPSParticipantImpl::register_in_reader(
2837
2849
}
2838
2850
else if (!fastdds::statistics::is_statistics_builtin (reader_guid.entityId ))
2839
2851
{
2840
- BaseReader* reader = find_local_reader (reader_guid);
2841
- res = reader->add_statistics_listener (listener);
2852
+ LocalReaderPointer::Instance local_reader (find_local_reader (reader_guid));
2853
+ if (local_reader)
2854
+ {
2855
+ res = local_reader->add_statistics_listener (listener);
2856
+ }
2842
2857
}
2843
2858
2844
2859
return res;
0 commit comments