Skip to content

Commit

Permalink
fix crash deleting a new column which contains changed values (fix #1…
Browse files Browse the repository at this point in the history
…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 ce62640
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/qgsvectorlayerundocommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
Expand Down Expand Up @@ -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.