Skip to content

Commit

Permalink
Fix missing cache skip in proj 6 code path
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jul 19, 2019
1 parent 86078d9 commit 4f6928b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/core/qgscoordinatetransform.cpp
Expand Up @@ -821,7 +821,10 @@ bool QgsCoordinateTransform::setFromCache( const QgsCoordinateReferenceSystem &s
if ( sourceKey.isEmpty() || destKey.isEmpty() )
return false;

sCacheLock.lockForRead();
QgsReadWriteLocker locker( sCacheLock, QgsReadWriteLocker::Read );
if ( sDisableCache )
return false;

const QList< QgsCoordinateTransform > values = sTransforms.values( qMakePair( sourceKey, destKey ) );
for ( auto valIt = values.constBegin(); valIt != values.constEnd(); ++valIt )
{
Expand All @@ -833,7 +836,7 @@ bool QgsCoordinateTransform::setFromCache( const QgsCoordinateReferenceSystem &s
bool hasContext = mHasContext;
#endif
*this = *valIt;
sCacheLock.unlock();
locker.unlock();

mContext = context;
#ifdef QGISDEBUG
Expand All @@ -843,7 +846,6 @@ bool QgsCoordinateTransform::setFromCache( const QgsCoordinateReferenceSystem &s
return true;
}
}
sCacheLock.unlock();
return false;
}
#else
Expand Down

0 comments on commit 4f6928b

Please sign in to comment.