Skip to content

Commit

Permalink
Merge branch 'main' into nkoenig/remove-ign
Browse files Browse the repository at this point in the history
  • Loading branch information
azeey authored Aug 25, 2023
2 parents 1940106 + c7c3011 commit 40936a0
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/plugins/topic_viewer/TopicViewer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -388,11 +388,19 @@ void TopicViewer::UpdateModel()
std::vector<transport::MessagePublisher> publishers;
std::vector<transport::MessagePublisher> subscribers;
this->dataPtr->node.TopicInfo(topics[i], publishers, subscribers);

if (publishers.empty())
continue;

// ToDo: Go over all the publishers and also consider subscribers.
// Review the way we're using "topicsToRemove" as the logic doesn't look
// very clear to me.

std::string msgType = publishers[0].MsgTypeName();

// skip the matched topics
if (this->dataPtr->currentTopics.count(topics[i]) &&
this->dataPtr->currentTopics[topics[i]] == msgType)
this->dataPtr->currentTopics[topics[i]] == msgType)
{
topicsToRemove.erase(topics[i]);
continue;
Expand All @@ -413,7 +421,7 @@ void TopicViewer::UpdateModel()
auto child = root->child(i);

if (child->data(NAME_ROLE).toString().toStdString() == topic.first &&
child->data(TYPE_ROLE).toString().toStdString() == topic.second)
child->data(TYPE_ROLE).toString().toStdString() == topic.second)
{
// remove from model
root->removeRow(i);
Expand Down

0 comments on commit 40936a0

Please sign in to comment.