Skip to content

Commit 046f901

Browse files
author
mhugent
committedApr 21, 2006
cache geometries only if layer is editable
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5327 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 2efa86e commit 046f901

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed
 

‎src/gui/qgsvectorlayer.cpp

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -797,14 +797,17 @@ void QgsVectorLayer::draw(QPainter * p, QgsRect * viewExtent, QgsMapToPixel * th
797797
QgsDebugMsg("QgsVectorLayer::draw: Destroying all cached geometries.");
798798

799799
// TODO: This area has suspect memory management
800-
for (std::map<int, QgsGeometry*>::iterator it = mCachedGeometries.begin();
801-
it != mCachedGeometries.end();
802-
++it )
803-
{
804-
delete (*it).second;
805-
}
806-
QgsDebugMsg("QgsVectorLayer::draw: Clearing all cached geometries.");
807-
mCachedGeometries.clear();
800+
if(mEditable)
801+
{
802+
for (std::map<int, QgsGeometry*>::iterator it = mCachedGeometries.begin();
803+
it != mCachedGeometries.end();
804+
++it )
805+
{
806+
delete (*it).second;
807+
}
808+
QgsDebugMsg("QgsVectorLayer::draw: Clearing all cached geometries.");
809+
mCachedGeometries.clear();
810+
}
808811

809812
dataProvider->select(viewExtent);
810813
dataProvider->updateFeatureCount();
@@ -871,8 +874,10 @@ void QgsVectorLayer::draw(QPainter * p, QgsRect * viewExtent, QgsMapToPixel * th
871874
}
872875

873876
// Cache this for the use of (e.g.) modifying the feature's uncommitted geometry.
874-
mCachedGeometries[fet->featureId()] = fet->geometryAndOwnership();
875-
877+
if(mEditable)
878+
{
879+
mCachedGeometries[fet->featureId()] = fet->geometryAndOwnership();
880+
}
876881
bool sel=mSelected.find(fet->featureId()) != mSelected.end();
877882
m_renderer->renderFeature(p, fet, &marker, &markerScaleFactor,
878883
sel, widthScale );

0 commit comments

Comments
 (0)
Please sign in to comment.