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 nyalldawson committed Nov 20, 2020
1 parent 2f86f6d commit 8f1ba3137f9d5a3323d031bd9e5d30c02bb38ac2
Showing with 4 additions and 4 deletions.
  1. +4 −4 src/core/providers/ogr/qgsogrprovider.cpp
@@ -2510,11 +2510,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;
}

@@ -2618,11 +2617,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;
}

@@ -4523,6 +4521,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 8f1ba31

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