Acquire mutex before copying landmark poses. (#1007)

master
Alexander Belyaev 2018-03-19 16:16:46 +01:00 committed by GitHub
parent 4cc758e830
commit e48e21849a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 0 deletions

View File

@ -616,6 +616,7 @@ MapById<NodeId, TrajectoryNodePose> PoseGraph2D::GetTrajectoryNodePoses() {
std::map<std::string, transform::Rigid3d> PoseGraph2D::GetLandmarkPoses() { std::map<std::string, transform::Rigid3d> PoseGraph2D::GetLandmarkPoses() {
std::map<std::string, transform::Rigid3d> landmark_poses; std::map<std::string, transform::Rigid3d> landmark_poses;
common::MutexLocker locker(&mutex_);
for (const auto& landmark : landmark_nodes_) { for (const auto& landmark : landmark_nodes_) {
// Landmark without value has not been optimized yet. // Landmark without value has not been optimized yet.
if (!landmark.second.global_landmark_pose.has_value()) continue; if (!landmark.second.global_landmark_pose.has_value()) continue;

View File

@ -659,6 +659,7 @@ MapById<NodeId, TrajectoryNodePose> PoseGraph3D::GetTrajectoryNodePoses() {
std::map<std::string, transform::Rigid3d> PoseGraph3D::GetLandmarkPoses() { std::map<std::string, transform::Rigid3d> PoseGraph3D::GetLandmarkPoses() {
std::map<std::string, transform::Rigid3d> landmark_poses; std::map<std::string, transform::Rigid3d> landmark_poses;
common::MutexLocker locker(&mutex_);
for (const auto& landmark : landmark_nodes_) { for (const auto& landmark : landmark_nodes_) {
// Landmark without value has not been optimized yet. // Landmark without value has not been optimized yet.
if (!landmark.second.global_landmark_pose.has_value()) continue; if (!landmark.second.global_landmark_pose.has_value()) continue;