Skip to content
Permalink
Browse files

Immediately liberate connection of expression value gatherer

This fixes a deadlock

The iterator as a member as previously implemented kept connections
occupied for as long as the gatherer existed. This could lead to a
situation, where all connections have been reserved from finished
gatherers which were waiting to be deleted (through deleteLater),
but deleteLater would never happen because the main thread was
waiting for a connection to become available.

Fixes #37496
  • Loading branch information
m-kuhn authored and nyalldawson committed Jul 2, 2020
1 parent b1e3845 commit 4904344d40e88ed02b7c03083db354fb4b300c06
Showing with 2 additions and 3 deletions.
  1. +2 −3 src/core/qgsfeaturefiltermodel_p.h
@@ -52,7 +52,7 @@ class QgsFieldExpressionValuesGatherer: public QThread
{
mWasCanceled = false;

mIterator = mSource->getFeatures( mRequest );
QgsFeatureIterator iterator = mSource->getFeatures( mRequest );

mDisplayExpression.prepare( &mExpressionContext );

@@ -61,7 +61,7 @@ class QgsFieldExpressionValuesGatherer: public QThread
for ( const QString &fieldName : qgis::as_const( mIdentifierFields ) )
attributeIndexes << mSource->fields().indexOf( fieldName );

while ( mIterator.nextFeature( feat ) )
while ( iterator.nextFeature( feat ) )
{
mExpressionContext.setFeature( feat );
QVariantList attributes;
@@ -121,7 +121,6 @@ class QgsFieldExpressionValuesGatherer: public QThread
QgsExpression mDisplayExpression;
QgsExpressionContext mExpressionContext;
QgsFeatureRequest mRequest;
QgsFeatureIterator mIterator;
bool mWasCanceled = false;
mutable QMutex mCancelMutex;
QVector<QgsFeatureFilterModel::Entry> mEntries;

0 comments on commit 4904344

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