[QGIS Commit] r10667 - in trunk/qgis/src: core providers/ogr
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Mon Apr 27 11:46:57 EDT 2009
Author: mhugent
Date: 2009-04-27 11:46:57 -0400 (Mon, 27 Apr 2009)
New Revision: 10667
Modified:
trunk/qgis/src/core/qgsvectorlayer.cpp
trunk/qgis/src/providers/ogr/qgsogrprovider.cpp
Log:
Fix for bug #1657 and fix for a memory leak in ogr provider
Modified: trunk/qgis/src/core/qgsvectorlayer.cpp
===================================================================
--- trunk/qgis/src/core/qgsvectorlayer.cpp 2009-04-27 08:36:54 UTC (rev 10666)
+++ trunk/qgis/src/core/qgsvectorlayer.cpp 2009-04-27 15:46:57 UTC (rev 10667)
@@ -1707,7 +1707,7 @@
}
}
- //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 @@
}
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
}
Modified: trunk/qgis/src/providers/ogr/qgsogrprovider.cpp
===================================================================
--- trunk/qgis/src/providers/ogr/qgsogrprovider.cpp 2009-04-27 08:36:54 UTC (rev 10666)
+++ trunk/qgis/src/providers/ogr/qgsogrprovider.cpp 2009-04-27 15:46:57 UTC (rev 10667)
@@ -337,6 +337,8 @@
getFeatureAttribute( fet, feature, *it );
}
+ OGR_F_Destroy( fet );
+ feature.setValid( true );
return true;
}
More information about the QGIS-commit
mailing list