Skip to content
Permalink
Browse files

Proper invalidation of OGR sources on sync to disc

Fixes #39574 and #35144
  • Loading branch information
bjornharrtell authored and jef-n committed Nov 9, 2020
1 parent 383090f commit e5821d253f0d6e58f6f8eec30d895b0da6f26fc4
Showing with 4 additions and 4 deletions.
  1. +4 −4 src/core/providers/ogr/qgsogrprovider.cpp
@@ -2544,11 +2544,10 @@ bool QgsOgrProvider::changeAttributeValues( const QgsChangedAttributesMap &attr_
if ( mTransaction )
mTransaction->dirtyLastSavePoint();

if ( mOgrLayer->SyncToDisk() != OGRERR_NONE )
if ( !syncToDisc() )
{
pushError( tr( "OGR error syncing to disk: %1" ).arg( CPLGetLastErrorMsg() ) );
}
QgsOgrConnPool::instance()->invalidateConnections( QgsOgrProviderUtils::connectionPoolId( dataSourceUri( true ), mShareSameDatasetAmongLayers ) );
return returnValue;
}

@@ -2655,11 +2654,10 @@ bool QgsOgrProvider::changeGeometryValues( const QgsGeometryMap &geometry_map )
if ( mTransaction )
mTransaction->dirtyLastSavePoint();

if ( mOgrLayer->SyncToDisk() != OGRERR_NONE )
if ( !syncToDisc() )
{
pushError( tr( "OGR error syncing to disk: %1" ).arg( CPLGetLastErrorMsg() ) );
}
QgsOgrConnPool::instance()->invalidateConnections( QgsOgrProviderUtils::connectionPoolId( dataSourceUri( true ), mShareSameDatasetAmongLayers ) );
return returnvalue;
}

@@ -4572,6 +4570,8 @@ QString QgsOgrProviderUtils::quotedValue( const QVariant &value )

bool QgsOgrProvider::syncToDisc()
{
QgsOgrConnPool::instance()->invalidateConnections( QgsOgrProviderUtils::connectionPoolId( dataSourceUri( true ), mShareSameDatasetAmongLayers ) );

//for shapefiles, remove spatial index files and create a new index
QgsOgrConnPool::instance()->unref( QgsOgrProviderUtils::connectionPoolId( dataSourceUri( true ), mShareSameDatasetAmongLayers ) );
bool shapeIndex = false;

0 comments on commit e5821d2

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