Skip to content
Permalink
Browse files
Fixed #1427 - memory leak when overwriting feature with a new feature.
Changed grass provider to avoid copying (reuse QgsFeature instance as in other providers)


git-svn-id: http://svn.osgeo.org/qgis/trunk@9985 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Jan 20, 2009
1 parent 264062e commit 017c4d7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
@@ -61,9 +61,14 @@ QgsFeature & QgsFeature::operator=( QgsFeature const & rhs )
mAttributes = rhs.mAttributes;
mValid = rhs.mValid;
mTypeName = rhs.mTypeName;

// make sure to delete the old geometry (if exists)
if (mGeometry && mOwnsGeometry)
delete mGeometry;

mGeometry = 0;
mOwnsGeometry = false;

if ( rhs.mGeometry )
setGeometry( *rhs.mGeometry );

@@ -293,7 +293,7 @@ bool QgsGrassProvider::nextFeature( QgsFeature& feature )
int cat, type, id;
unsigned char *wkb;
int wkbsize;

QgsDebugMsgLevel( "entered.", 3 );

if ( isEdited() || isFrozen() || !mValid )
@@ -318,7 +318,7 @@ bool QgsGrassProvider::nextFeature( QgsFeature& feature )
QgsDebugMsg( QString( "cat = %1 type = %2 id = %3" ).arg( cat ).arg( type ).arg( id ) );
#endif

feature = QgsFeature( id );
feature.setFeatureId(id);

// TODO int may be 64 bits (memcpy)
if ( type & ( GV_POINTS | GV_LINES ) ) /* points or lines */

0 comments on commit 017c4d7

Please sign in to comment.