Skip to content
Permalink
Browse files

vector layer: update geometries first before feature id might change (f…

…ixes #8255)
  • Loading branch information
jef-n committed Oct 13, 2015
1 parent 957d826 commit 24b6e6387ec7b78ad87121bd19e4e30872feff6f
Showing with 20 additions and 20 deletions.
  1. +20 −20 src/core/qgsvectorlayereditbuffer.cpp
@@ -260,6 +260,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->fields();

//
@@ -502,26 +522,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:" );

0 comments on commit 24b6e63

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