Skip to content
Permalink
Browse files
Avoid deep copy of spatial index when features are fetched on
main thread
  • Loading branch information
nyalldawson committed Feb 9, 2018
1 parent 50a8813 commit 426c72f
Showing 1 changed file with 1 addition and 1 deletion.
@@ -240,7 +240,7 @@ QgsMemoryFeatureSource::QgsMemoryFeatureSource( const QgsMemoryProvider *p )
mExpressionContext.setFields( mFields );

// QgsSpatialIndex is not thread safe - so make spatial index safe to use across threads by forcing a full deep copy
if ( mSpatialIndex )
if ( mSpatialIndex && p->thread() != QThread::currentThread() )
mSpatialIndex->detach();
}

0 comments on commit 426c72f

Please sign in to comment.