Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix nondiscard warnings with lock_guard #373

Merged
merged 1 commit into from
Mar 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/plugins/point_cloud/PointCloud.cc
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ void PointCloud::LoadConfig(const tinyxml2::XMLElement *_pluginElem)
//////////////////////////////////////////////////
void PointCloud::OnPointCloudTopic(const QString &_pointCloudTopic)
{
std::lock_guard<std::recursive_mutex>(this->dataPtr->mutex);
std::lock_guard<std::recursive_mutex> lock(this->dataPtr->mutex);
// Unsubscribe from previous choice
if (!this->dataPtr->pointCloudTopic.empty() &&
!this->dataPtr->node.Unsubscribe(this->dataPtr->pointCloudTopic))
Expand Down Expand Up @@ -176,7 +176,7 @@ void PointCloud::OnPointCloudTopic(const QString &_pointCloudTopic)
//////////////////////////////////////////////////
void PointCloud::OnFloatVTopic(const QString &_floatVTopic)
{
std::lock_guard<std::recursive_mutex>(this->dataPtr->mutex);
std::lock_guard<std::recursive_mutex> lock(this->dataPtr->mutex);
// Unsubscribe from previous choice
if (!this->dataPtr->floatVTopic.empty() &&
!this->dataPtr->node.Unsubscribe(this->dataPtr->floatVTopic))
Expand Down Expand Up @@ -222,7 +222,7 @@ void PointCloud::Show(bool _show)
/////////////////////////////////////////////////
void PointCloud::OnRefresh()
{
std::lock_guard<std::recursive_mutex>(this->dataPtr->mutex);
std::lock_guard<std::recursive_mutex> lock(this->dataPtr->mutex);
ignmsg << "Refreshing topic list for point cloud messages." << std::endl;

// Clear
Expand Down Expand Up @@ -296,15 +296,15 @@ void PointCloud::SetFloatVTopicList(
void PointCloud::OnPointCloud(
const ignition::msgs::PointCloudPacked &_msg)
{
std::lock_guard<std::recursive_mutex>(this->dataPtr->mutex);
std::lock_guard<std::recursive_mutex> lock(this->dataPtr->mutex);
this->dataPtr->pointCloudMsg = _msg;
this->dataPtr->PublishMarkers();
}

//////////////////////////////////////////////////
void PointCloud::OnFloatV(const ignition::msgs::Float_V &_msg)
{
std::lock_guard<std::recursive_mutex>(this->dataPtr->mutex);
std::lock_guard<std::recursive_mutex> lock(this->dataPtr->mutex);
this->dataPtr->floatVMsg = _msg;

this->dataPtr->minFloatV = std::numeric_limits<float>::max();
Expand Down Expand Up @@ -365,7 +365,7 @@ void PointCloudPrivate::PublishMarkers()
return;
}

std::lock_guard<std::recursive_mutex>(this->mutex);
std::lock_guard<std::recursive_mutex> lock(this->mutex);
ignition::msgs::Marker marker;
marker.set_ns(this->pointCloudTopic + this->floatVTopic);
marker.set_id(1);
Expand Down Expand Up @@ -429,7 +429,7 @@ void PointCloudPrivate::ClearMarkers()
if (this->pointCloudTopic.empty())
return;

std::lock_guard<std::recursive_mutex>(this->mutex);
std::lock_guard<std::recursive_mutex> lock(this->mutex);
ignition::msgs::Marker msg;
msg.set_ns(this->pointCloudTopic + this->floatVTopic);
msg.set_id(0);
Expand Down