Skip to content

Commit

Permalink
Fix for bug #1657 and fix for a memory leak in ogr provider
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@10667 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Apr 27, 2009
1 parent 10c3484 commit e137b09
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/core/qgsvectorlayer.cpp
Expand Up @@ -1707,7 +1707,7 @@ int QgsVectorLayer::translateFeature( int featureId, double dx, double dy )
}
}

//else, if must be contained in mCachedGeometries
//else look in mCachedGeometries to make access faster
QgsGeometryMap::iterator cachedIt = mCachedGeometries.find( featureId );
if ( cachedIt != mCachedGeometries.end() )
{
Expand All @@ -1719,6 +1719,23 @@ int QgsVectorLayer::translateFeature( int featureId, double dx, double dy )
}
return errorCode;
}

//else get the geometry from provider (may be slow)
QgsFeature f;
if(mDataProvider && mDataProvider->featureAtId(featureId, f, true))
{
if(f.geometry())
{
QgsGeometry translateGeom(*(f.geometry()));
int errorCode = translateGeom.translate(dx, dy);
if(errorCode == 0)
{
mChangedGeometries.insert(featureId, translateGeom);
setModified(true, true);
}
return errorCode;
}
}
return 1; //geometry not found
}

Expand Down
2 changes: 2 additions & 0 deletions src/providers/ogr/qgsogrprovider.cpp
Expand Up @@ -337,6 +337,8 @@ bool QgsOgrProvider::featureAtId( int featureId,
getFeatureAttribute( fet, feature, *it );
}

OGR_F_Destroy( fet );
feature.setValid( true );
return true;
}

Expand Down

0 comments on commit e137b09

Please sign in to comment.