Skip to content

Commit

Permalink
Avoid some unnecessary detachments in memory provider
Browse files Browse the repository at this point in the history
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 59d4b85
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/providers/memory/qgsmemoryfeatureiterator.cpp
Expand Up @@ -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;
}
Expand All @@ -115,7 +115,7 @@ bool QgsMemoryFeatureIterator::nextFeatureUsingList( QgsFeature& feature )
// copy feature
if ( hasFeature )
{
feature = mSource->mFeatures[*mFeatureIdListIterator];
feature = mSource->mFeatures.value( *mFeatureIdListIterator );
++mFeatureIdListIterator;
}
else
Expand Down

0 comments on commit 59d4b85

Please sign in to comment.