diff --git a/cartographer/mapping/internal/2d/pose_graph_2d.cc b/cartographer/mapping/internal/2d/pose_graph_2d.cc index 5f12521..79862a6 100644 --- a/cartographer/mapping/internal/2d/pose_graph_2d.cc +++ b/cartographer/mapping/internal/2d/pose_graph_2d.cc @@ -392,6 +392,7 @@ void PoseGraph2D::WaitForAllComputations() { } void PoseGraph2D::FinishTrajectory(const int trajectory_id) { + common::MutexLocker locker(&mutex_); AddWorkItem([this, trajectory_id]() REQUIRES(mutex_) { CHECK_EQ(finished_trajectories_.count(trajectory_id), 0); finished_trajectories_.insert(trajectory_id); diff --git a/cartographer/mapping/internal/3d/pose_graph_3d.cc b/cartographer/mapping/internal/3d/pose_graph_3d.cc index e9cc96d..7c81fd8 100644 --- a/cartographer/mapping/internal/3d/pose_graph_3d.cc +++ b/cartographer/mapping/internal/3d/pose_graph_3d.cc @@ -410,6 +410,7 @@ void PoseGraph3D::WaitForAllComputations() { } void PoseGraph3D::FinishTrajectory(const int trajectory_id) { + common::MutexLocker locker(&mutex_); AddWorkItem([this, trajectory_id]() REQUIRES(mutex_) { CHECK_EQ(finished_trajectories_.count(trajectory_id), 0); finished_trajectories_.insert(trajectory_id);