Skip to content

Commit

Permalink
Update QgsFields nameToIndex hash on field removed
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaud-morvan authored and m-kuhn committed May 26, 2015
1 parent 9b79747 commit ae242f5
Show file tree
Hide file tree
Showing 2 changed files with 410 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/core/qgsfield.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,12 @@ void QgsFields::remove( int fieldIdx )
if ( !exists( fieldIdx ) )
return;

mNameToIndex.remove( mFields[fieldIdx].field.name() );
mFields.remove( fieldIdx );
d->fields.remove( fieldIdx );
d->nameToIndex.clear();
for ( int idx = 0; idx < count(); ++idx )
{
d->nameToIndex.insert( d->fields[idx].field.name(), idx );
}
}

void QgsFields::extend( const QgsFields& other )
Expand Down
Loading

0 comments on commit ae242f5

Please sign in to comment.