Skip to content

Commit 426c72f

Browse files
committed
Avoid deep copy of spatial index when features are fetched on
main thread
1 parent 50a8813 commit 426c72f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/core/providers/memory/qgsmemoryfeatureiterator.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ QgsMemoryFeatureSource::QgsMemoryFeatureSource( const QgsMemoryProvider *p )
240240
mExpressionContext.setFields( mFields );
241241

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

0 commit comments

Comments
 (0)