From 8878e9b30b68f8ad4454b3c27b399ba610795eed Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Fri, 29 Nov 2019 09:55:17 +1000 Subject: [PATCH] Use QMutexLocker --- src/core/pal/pal.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/pal/pal.cpp b/src/core/pal/pal.cpp index 804b880c533..be9e6e90ee6 100644 --- a/src/core/pal/pal.cpp +++ b/src/core/pal/pal.cpp @@ -266,7 +266,7 @@ std::unique_ptr Pal::extract( const QgsRectangle &extent, const QgsGeom QStringList layersWithFeaturesInBBox; - mMutex.lock(); + QMutexLocker palLocker( &mMutex ); for ( const auto &it : mLayers ) { Layer *layer = it.second.get(); @@ -286,7 +286,7 @@ std::unique_ptr Pal::extract( const QgsRectangle &extent, const QgsGeom layer->chopFeaturesAtRepeatDistance(); - layer->mMutex.lock(); + QMutexLocker locker( &layer->mMutex ); // find features within bounding box and generate candidates list context.layer = layer; @@ -294,7 +294,7 @@ std::unique_ptr Pal::extract( const QgsRectangle &extent, const QgsGeom // find obstacles within bounding box layer->mObstacleIndex.Search( amin, amax, extractObstaclesCallback, static_cast< void * >( &obstacleContext ) ); - layer->mMutex.unlock(); + locker.unlock(); if ( context.features->size() - previousFeatureCount > 0 || obstacleContext.obstacleCount > previousObstacleCount ) { @@ -303,7 +303,7 @@ std::unique_ptr Pal::extract( const QgsRectangle &extent, const QgsGeom previousFeatureCount = context.features->size(); previousObstacleCount = obstacleContext.obstacleCount; } - mMutex.unlock(); + palLocker.unlock(); prob->mLayerCount = layersWithFeaturesInBBox.size(); prob->labelledLayersName = layersWithFeaturesInBBox;