Skip to content
Permalink
Browse files

Fix for bug #1657 and fix for a memory leak in ogr provider

git-svn-id: http://svn.osgeo.org/qgis/trunk@10667 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent
mhugent committed Apr 27, 2009
1 parent 10c3484 commit e137b09512733dcf495df32ad283e9c17d7b7808
Showing with 20 additions and 1 deletion.
  1. +18 −1 src/core/qgsvectorlayer.cpp
  2. +2 −0 src/providers/ogr/qgsogrprovider.cpp
@@ -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() )
{
@@ -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
}

@@ -337,6 +337,8 @@ bool QgsOgrProvider::featureAtId( int featureId,
getFeatureAttribute( fet, feature, *it );
}

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

0 comments on commit e137b09

Please sign in to comment.
You can’t perform that action at this time.