Skip to content

Commit

Permalink
Revert "Fix locking of ogr datasource in case the datasource is share…
Browse files Browse the repository at this point in the history
…d (trans…"
  • Loading branch information
mhugent committed Nov 30, 2021
1 parent f65ea56 commit 4773973
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/core/providers/ogr/qgsogrfeatureiterator.cpp
Expand Up @@ -53,11 +53,6 @@ QgsOgrFeatureIterator::QgsOgrFeatureIterator( QgsOgrFeatureSource *source, bool
, mSymbolType( QgsSymbol::symbolTypeForGeometryType( QgsWkbTypes::geometryType( source->mWkbType ) ) )
{

if ( mSharedDS )
{
mSharedDS->mutex().lock();
}

/* When inside a transaction for GPKG/SQLite and fetching fid(s) we might be nested inside an outer fetching loop,
* (see GH #39178) so we need to skip all calls that might reset the reading (rewind) to avoid an endless loop in the
* outer fetching iterator that uses the same connection.
Expand Down Expand Up @@ -129,6 +124,7 @@ QgsOgrFeatureIterator::QgsOgrFeatureIterator( QgsOgrFeatureSource *source, bool
}
}
}
QMutexLocker locker( mSharedDS ? &mSharedDS->mutex() : nullptr );

if ( mRequest.destinationCrs().isValid() && mRequest.destinationCrs() != mSource->mCrs )
{
Expand Down Expand Up @@ -376,6 +372,8 @@ void QgsOgrFeatureIterator::setInterruptionChecker( QgsFeedback *interruptionChe

bool QgsOgrFeatureIterator::fetchFeature( QgsFeature &feature )
{
QMutexLocker locker( mSharedDS ? &mSharedDS->mutex() : nullptr );

QgsCPLHTTPFetchOverrider oCPLHTTPFetcher( mAuthCfg, mInterruptionChecker );
QgsSetCPLHTTPFetchOverriderInitiatorClass( oCPLHTTPFetcher, QStringLiteral( "QgsOgrFeatureIterator" ) )

Expand Down Expand Up @@ -471,6 +469,8 @@ void QgsOgrFeatureIterator::resetReading()

bool QgsOgrFeatureIterator::rewind()
{
QMutexLocker locker( mSharedDS ? &mSharedDS->mutex() : nullptr );

if ( mClosed || !mOgrLayer )
return false;

Expand All @@ -487,10 +487,10 @@ bool QgsOgrFeatureIterator::close()
if ( mSharedDS )
{
iteratorClosed();

mOgrLayer = nullptr;
mClosed = true;
mSharedDS->mutex().unlock();
mSharedDS.reset();
mClosed = true;
return true;
}

Expand Down Expand Up @@ -525,9 +525,6 @@ bool QgsOgrFeatureIterator::close()
mOgrLayer = nullptr;

mClosed = true;



return true;
}

Expand Down

0 comments on commit 4773973

Please sign in to comment.