Fix Clang thread-safety warning. (#1068)

reading variable 'submap_slices_' requires holding mutex 'mutex_' [-Wthread-safety-analysis]
master
Michael Grupp 2018-10-19 08:27:58 +02:00 committed by Alexander Belyaev
parent ed418405b5
commit 725815177a
1 changed files with 1 additions and 2 deletions

View File

@ -164,11 +164,10 @@ void Node::HandleSubmapList(
}
void Node::DrawAndPublish(const ::ros::WallTimerEvent& unused_timer_event) {
absl::MutexLock locker(&mutex_);
if (submap_slices_.empty() || last_frame_id_.empty()) {
return;
}
absl::MutexLock locker(&mutex_);
auto painted_slices = PaintSubmapSlices(submap_slices_, resolution_);
std::unique_ptr<nav_msgs::OccupancyGrid> msg_ptr = CreateOccupancyGridMsg(
painted_slices, resolution_, last_frame_id_, last_timestamp_);