Skip to content

Commit

Permalink
Fix broken QgsFeatureStore::setFields method
Browse files Browse the repository at this point in the history
Was setting fields only on temporary copies of the features, not
the stored features themselves

(cherry-picked from 910cb01)
  • Loading branch information
nyalldawson committed Sep 16, 2015
1 parent 8538be6 commit c8d625a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion python/core/qgsfeaturestore.sip
Expand Up @@ -19,7 +19,7 @@ class QgsFeatureStore
/** Get fields list */
QgsFields& fields();

/** Set fields. Resets feauters fields to pointer to new internal fields. */
/** Set fields. Resets feature's fields to pointer to new internal fields. */
void setFields( const QgsFields & fields );

/** Get crs */
Expand Down
5 changes: 3 additions & 2 deletions src/core/qgsfeaturestore.cpp
Expand Up @@ -40,9 +40,10 @@ QgsFeatureStore::~QgsFeatureStore()
void QgsFeatureStore::setFields( const QgsFields & fields )
{
mFields = fields;
foreach ( QgsFeature feature, mFeatures )
QgsFeatureList::iterator it = mFeatures.begin();
for ( ; it != mFeatures.end(); ++it )
{
feature.setFields( &mFields );
( *it ).setFields( &mFields );
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsfeaturestore.h
Expand Up @@ -45,7 +45,7 @@ class CORE_EXPORT QgsFeatureStore
/** Get fields list */
QgsFields& fields() { return mFields; }

/** Set fields. Resets feauters fields to pointer to new internal fields. */
/** Set fields. Resets feature's fields to pointer to new internal fields. */
void setFields( const QgsFields & fields );

/** Get crs */
Expand Down

0 comments on commit c8d625a

Please sign in to comment.