Skip to content
Permalink
Browse files

Avoid some unnecessary detachments in memory provider

Should speed up the provider slightly and also refs #14559 (I can
no longer reproduce that crash with this change)
  • Loading branch information
nyalldawson committed Mar 29, 2016
1 parent f7c28f6 commit 59d4b85c73aff475429005f321d6009ade9fc8c6
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/providers/memory/qgsmemoryfeatureiterator.cpp
@@ -93,15 +93,15 @@ bool QgsMemoryFeatureIterator::nextFeatureUsingList( QgsFeature& feature )
if ( !mRequest.filterRect().isNull() && mRequest.flags() & QgsFeatureRequest::ExactIntersect )
{
// do exact check in case we're doing intersection
if ( mSource->mFeatures[*mFeatureIdListIterator].geometry() && mSource->mFeatures[*mFeatureIdListIterator].geometry()->intersects( mSelectRectGeom ) )
if ( mSource->mFeatures.value( *mFeatureIdListIterator ).constGeometry() && mSource->mFeatures.value( *mFeatureIdListIterator ).constGeometry()->intersects( mSelectRectGeom ) )
hasFeature = true;
}
else
hasFeature = true;

if ( mSubsetExpression )
{
mSource->mExpressionContext.setFeature( mSource->mFeatures[*mFeatureIdListIterator] );
mSource->mExpressionContext.setFeature( mSource->mFeatures.value( *mFeatureIdListIterator ) );
if ( !mSubsetExpression->evaluate( &mSource->mExpressionContext ).toBool() )
hasFeature = false;
}
@@ -115,7 +115,7 @@ bool QgsMemoryFeatureIterator::nextFeatureUsingList( QgsFeature& feature )
// copy feature
if ( hasFeature )
{
feature = mSource->mFeatures[*mFeatureIdListIterator];
feature = mSource->mFeatures.value( *mFeatureIdListIterator );
++mFeatureIdListIterator;
}
else

0 comments on commit 59d4b85

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