File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
include/agent/graph_manager Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -305,7 +305,7 @@ class GraphManager
305305 // Store a auxiliary publishers and datawriter for each participant created in micro-ROS
306306 std::map<
307307 const eprosima::fastdds::dds::DomainParticipant*,
308- std::unique_ptr< eprosima::fastdds::dds::DataWriter>
308+ eprosima::fastdds::dds::DataWriter*
309309 > micro_ros_graph_datawriters_;
310310};
311311
Original file line number Diff line number Diff line change @@ -322,11 +322,10 @@ void GraphManager::add_participant(
322322 if (it == micro_ros_graph_datawriters_.end ())
323323 {
324324 // Create datawriter
325- std::unique_ptr<eprosima::fastdds::dds::DataWriter> datawriter;
326- datawriter.reset (publisher_->create_datawriter (ros_discovery_topic_.get (), datawriter_qos_));
325+ eprosima::fastdds::dds::DataWriter * datawriter = publisher_->create_datawriter (ros_discovery_topic_.get (), datawriter_qos_);
327326
328327 it = micro_ros_graph_datawriters_.insert (
329- std::make_pair (participant, std::move ( datawriter) )).first ;
328+ std::make_pair (participant, datawriter)).first ;
330329 }
331330
332331 it->second ->write (static_cast <void *>(&info));
@@ -346,8 +345,9 @@ void GraphManager::remove_participant(
346345 rmw_dds_common::convert_gid_to_msg (&gid, &info.gid );
347346 auto it = micro_ros_graph_datawriters_.find (participant);
348347 it->second ->write (static_cast <void *>(&info));
348+ publisher_->delete_datawriter (it->second );
349+ micro_ros_graph_datawriters_.erase (participant);
349350 }
350- micro_ros_graph_datawriters_.erase (participant);
351351}
352352
353353void GraphManager::add_datawriter (
You can’t perform that action at this time.
0 commit comments