Skip to content

Commit

Permalink
vector layer: update geometries first before feature id might change (f…
Browse files Browse the repository at this point in the history
…ixes #8255)

(backported from commit 24b6e63)
  • Loading branch information
jef-n committed Nov 26, 2015
1 parent 6c3290b commit e9d2a0e
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions src/core/qgsvectorlayereditbuffer.cpp
Expand Up @@ -258,6 +258,26 @@ bool QgsVectorLayerEditBuffer::commitChanges( QStringList& commitErrors )
int cap = provider->capabilities();
bool success = true;

//
// update geometries
//
if ( !mChangedGeometries.isEmpty() )
{
if (( cap & QgsVectorDataProvider::ChangeGeometries ) && provider->changeGeometryValues( mChangedGeometries ) )
{
commitErrors << tr( "SUCCESS: %n geometries were changed.", "changed geometries count", mChangedGeometries.size() );

emit committedGeometriesChanges( L->id(), mChangedGeometries );

mChangedGeometries.clear();
}
else
{
commitErrors << tr( "ERROR: %n geometries not changed.", "not changed geometries count", mChangedGeometries.size() );
success = false;
}
}

QgsFields oldFields = L->pendingFields();

//
Expand Down Expand Up @@ -500,26 +520,6 @@ bool QgsVectorLayerEditBuffer::commitChanges( QStringList& commitErrors )
success = false;
}

//
// update geometries
//
if ( success && !mChangedGeometries.isEmpty() )
{
if (( cap & QgsVectorDataProvider::ChangeGeometries ) && provider->changeGeometryValues( mChangedGeometries ) )
{
commitErrors << tr( "SUCCESS: %n geometries were changed.", "changed geometries count", mChangedGeometries.size() );

emit committedGeometriesChanges( L->id(), mChangedGeometries );

mChangedGeometries.clear();
}
else
{
commitErrors << tr( "ERROR: %n geometries not changed.", "not changed geometries count", mChangedGeometries.size() );
success = false;
}
}

if ( !success && provider->hasErrors() )
{
commitErrors << tr( "\n Provider errors:" );
Expand Down

0 comments on commit e9d2a0e

Please sign in to comment.