Skip to content
Permalink
Browse files

remove read lock

  • Loading branch information
3nids committed May 19, 2020
1 parent 606e4ca commit db4b215d61e12ad52af1e2cbf256f62cd97cf169
Showing with 0 additions and 16 deletions.
  1. +0 −14 src/core/qgslocalizeddatapathregistry.cpp
  2. +0 −2 src/core/qgslocalizeddatapathregistry.h
@@ -28,8 +28,6 @@ QgsLocalizedDataPathRegistry::QgsLocalizedDataPathRegistry()

QString QgsLocalizedDataPathRegistry::globalPath( const QString &relativePath ) const
{
QgsReadWriteLocker locker( mLock, QgsReadWriteLocker::Read );

for ( const QDir &basePath : qgis::as_const( mPaths ) )
if ( basePath.exists( relativePath ) )
return basePath.absoluteFilePath( relativePath );
@@ -39,8 +37,6 @@ QString QgsLocalizedDataPathRegistry::globalPath( const QString &relativePath )

QString QgsLocalizedDataPathRegistry::localizedPath( const QString &fullPath ) const
{
QgsReadWriteLocker locker( mLock, QgsReadWriteLocker::Read );

for ( const QDir &basePath : qgis::as_const( mPaths ) )
if ( fullPath.startsWith( basePath.absolutePath() ) )
return basePath.relativeFilePath( fullPath );
@@ -51,8 +47,6 @@ QString QgsLocalizedDataPathRegistry::localizedPath( const QString &fullPath ) c

QStringList QgsLocalizedDataPathRegistry::paths() const
{
QgsReadWriteLocker locker( mLock, QgsReadWriteLocker::Read );

QStringList paths;
for ( const QDir &dir : mPaths )
paths << dir.absolutePath();
@@ -61,8 +55,6 @@ QStringList QgsLocalizedDataPathRegistry::paths() const

void QgsLocalizedDataPathRegistry::setPaths( const QStringList &paths )
{
QgsReadWriteLocker locker( mLock, QgsReadWriteLocker::Write );

mPaths.clear();
for ( const QString &path : paths )
{
@@ -76,14 +68,10 @@ void QgsLocalizedDataPathRegistry::setPaths( const QStringList &paths )

void QgsLocalizedDataPathRegistry::registerPath( const QString &path, int position )
{
QgsReadWriteLocker locker( mLock, QgsReadWriteLocker::Read );

QDir dir( path );
if ( mPaths.contains( dir ) )
return;

locker.changeMode( QgsReadWriteLocker::Write );

if ( position >= 0 && position < mPaths.count() )
mPaths.insert( position, dir );
else
@@ -94,8 +82,6 @@ void QgsLocalizedDataPathRegistry::registerPath( const QString &path, int positi

void QgsLocalizedDataPathRegistry::unregisterPath( const QString &path )
{
QgsReadWriteLocker locker( mLock, QgsReadWriteLocker::Write );

mPaths.removeAll( QDir( path ) );
writeToSettings();
}
@@ -20,7 +20,6 @@

#include <QDir>
#include <QList>
#include <QReadWriteLock>

#include "qgis_core.h"
#include "qgis_sip.h"
@@ -70,7 +69,6 @@ class CORE_EXPORT QgsLocalizedDataPathRegistry
void writeToSettings();

QList<QDir> mPaths;
mutable QReadWriteLock mLock;
};

#endif // QGSLOCALIZEDDATAPATHREGISTRY_H

0 comments on commit db4b215

Please sign in to comment.
You can’t perform that action at this time.