Skip to content
Permalink
Browse files

fix crash deleting a new column which contains changed values (fix #1…

…3366),

when a column is deleted just rearrange changed attribute map indexes before calling updateLayerFields on the buffer,
otherwise QgsVectorLayerFeatureIterator::updateChangedAttributes will use the changed attribute map with old/wrong indexes
  • Loading branch information
brushtyler committed Sep 21, 2015
1 parent a17dac0 commit ce6264065de0ee4a01f305b411251d65ae54f97f
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/core/qgsvectorlayerundocommand.cpp
@@ -323,8 +323,8 @@ void QgsVectorLayerUndoCommandAddAttribute::undo()
int index = layer()->fields().fieldOriginIndex( mFieldIndex );

mBuffer->mAddedAttributes.removeAt( index );
mBuffer->updateLayerFields();
mBuffer->handleAttributeDeleted( mFieldIndex );
mBuffer->updateLayerFields();

emit mBuffer->attributeDeleted( mFieldIndex );
}
@@ -417,7 +417,7 @@ void QgsVectorLayerUndoCommandDeleteAttribute::redo()
mBuffer->mAddedAttributes.removeAt( mOriginIndex ); // removing temporary attribute
}

mBuffer->updateLayerFields();
mBuffer->handleAttributeDeleted( mFieldIndex ); // update changed attributes + new features
mBuffer->updateLayerFields();
emit mBuffer->attributeDeleted( mFieldIndex );
}

0 comments on commit ce62640

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