Skip to content

Commit

Permalink
Protect remoteSubscribers with mutex. (#432)
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Agüero <[email protected]>
  • Loading branch information
caguero authored Aug 25, 2023
1 parent 91acfb0 commit c507108
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion include/gz/transport/Discovery.hh
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,10 @@ namespace gz
/// \param[out] _topics List of advertised topics.
public: void TopicList(std::vector<std::string> &_topics)
{
this->remoteSubscribers.Clear();
{
std::lock_guard<std::mutex> lock(this->mutex);
this->remoteSubscribers.Clear();
}

// Request the list of subscribers.
Publisher pub("", "", this->pUuid, "", AdvertiseOptions());
Expand Down

0 comments on commit c507108

Please sign in to comment.