Skip to content

Commit

Permalink
remove read lock
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed May 19, 2020
1 parent 606e4ca commit db4b215
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 16 deletions.
14 changes: 0 additions & 14 deletions src/core/qgslocalizeddatapathregistry.cpp
Expand Up @@ -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 );
Expand All @@ -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 );
Expand All @@ -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();
Expand All @@ -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 )
{
Expand All @@ -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
Expand All @@ -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();
}
Expand Down
2 changes: 0 additions & 2 deletions src/core/qgslocalizeddatapathregistry.h
Expand Up @@ -20,7 +20,6 @@

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

#include "qgis_core.h"
#include "qgis_sip.h"
Expand Down Expand Up @@ -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.