Skip to content

Commit

Permalink
fix data race: VoxelLayer::matchSize may be executed concurrently (#2513
Browse files Browse the repository at this point in the history
)

Co-authored-by: Kai-Tao Xie <[email protected]>
  • Loading branch information
2 people authored and SteveMacenski committed Sep 14, 2021
1 parent b33e382 commit e326d3f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions nav2_costmap_2d/plugins/voxel_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ VoxelLayer::~VoxelLayer()

void VoxelLayer::matchSize()
{
std::lock_guard<Costmap2D::mutex_t> guard(*getMutex());
ObstacleLayer::matchSize();
voxel_grid_.resize(size_x_, size_y_, size_z_);
assert(voxel_grid_.sizeX() == size_x_ && voxel_grid_.sizeY() == size_y_);
Expand Down

0 comments on commit e326d3f

Please sign in to comment.