Skip to content

Commit 502e528

Browse files
authored
Lock parent costmap mutex on updateBounds to avoid deadlock when clearing an area (SteveMacenski#247)
1 parent 67575e0 commit 502e528

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/spatio_temporal_voxel_layer.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,10 @@ void SpatioTemporalVoxelLayer::updateBounds(
725725
return;
726726
}
727727

728+
// Required because UpdateROSCostmap will also lock if AFTER we lock here voxel_grid_lock,
729+
// and if clearArea is called in between, we will have a deadlock
730+
boost::unique_lock<mutex_t> cm_lock(*getMutex());
731+
728732
boost::recursive_mutex::scoped_lock lock(_voxel_grid_lock);
729733

730734
// Steve's Note June 22, 2018

0 commit comments

Comments
 (0)