Fix Clang thread-safety warning. (#1068)
reading variable 'submap_slices_' requires holding mutex 'mutex_' [-Wthread-safety-analysis]master
parent
ed418405b5
commit
725815177a
|
@ -164,11 +164,10 @@ void Node::HandleSubmapList(
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::DrawAndPublish(const ::ros::WallTimerEvent& unused_timer_event) {
|
void Node::DrawAndPublish(const ::ros::WallTimerEvent& unused_timer_event) {
|
||||||
|
absl::MutexLock locker(&mutex_);
|
||||||
if (submap_slices_.empty() || last_frame_id_.empty()) {
|
if (submap_slices_.empty() || last_frame_id_.empty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
absl::MutexLock locker(&mutex_);
|
|
||||||
auto painted_slices = PaintSubmapSlices(submap_slices_, resolution_);
|
auto painted_slices = PaintSubmapSlices(submap_slices_, resolution_);
|
||||||
std::unique_ptr<nav_msgs::OccupancyGrid> msg_ptr = CreateOccupancyGridMsg(
|
std::unique_ptr<nav_msgs::OccupancyGrid> msg_ptr = CreateOccupancyGridMsg(
|
||||||
painted_slices, resolution_, last_frame_id_, last_timestamp_);
|
painted_slices, resolution_, last_frame_id_, last_timestamp_);
|
||||||
|
|
Loading…
Reference in New Issue