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 1, 2020
1 parent 2a786ae commit 9360515dc3a21e72cbbc6a7caaa23e57d74109f4
Showing with 2 additions and 3 deletions.
  1. +2 −3 src/core/qgsfeatureexpressionvaluesgatherer.h
@@ -91,7 +91,7 @@ class QgsFeatureExpressionValuesGatherer: public QThread
{
mWasCanceled = false;

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

mDisplayExpression.prepare( &mExpressionContext );

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

while ( mIterator.nextFeature( feature ) )
while ( iterator.nextFeature( feature ) )
{
mExpressionContext.setFeature( feature );
QVariantList attributes;
@@ -165,7 +165,6 @@ class QgsFeatureExpressionValuesGatherer: public QThread
QgsExpression mDisplayExpression;
QgsExpressionContext mExpressionContext;
QgsFeatureRequest mRequest;
QgsFeatureIterator mIterator;
bool mWasCanceled = false;
mutable QMutex mCancelMutex;
QStringList mIdentifierFields;

0 comments on commit 9360515

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