Skip to content
Permalink
Browse files

Fix memory management of errors

  • Loading branch information
m-kuhn committed Oct 2, 2018
1 parent 9c6c3aa commit b0d8d8ea96f4647f9e4a8d69346b85bba483f709
Showing with 3 additions and 3 deletions.
  1. +2 −2 src/app/qgsgeometryvalidationservice.cpp
  2. +1 −1 src/app/qgsgeometryvalidationservice.h
@@ -270,7 +270,7 @@ void QgsGeometryValidationService::triggerTopologyChecks( QgsVectorLayer *layer
mFeaturePools.insert( layer->id(), featurePool );
}

QList<QgsGeometryCheckError *> &allErrors = mLayerChecks[layer].topologyCheckErrors;
QList<std::shared_ptr<QgsGeometryCheckError>> &allErrors = mLayerChecks[layer].topologyCheckErrors;
QMap<QString, QgsFeatureIds> layerIds;

QgsFeatureRequest request = QgsFeatureRequest( affectedFeatureIds ).setSubsetOfAttributes( QgsAttributeList() );
@@ -306,13 +306,13 @@ void QgsGeometryValidationService::triggerTopologyChecks( QgsVectorLayer *layer

check->collectErrors( mFeaturePools, errors, messages, feedback, layerFeatureIds );
QgsReadWriteLocker errorLocker( mTopologyCheckLock, QgsReadWriteLocker::Write );
allErrors.append( errors );

QList<std::shared_ptr<QgsGeometryCheckError> > sharedErrors;
for ( QgsGeometryCheckError *error : errors )
{
sharedErrors.append( std::shared_ptr<QgsGeometryCheckError>( error ) );
}
allErrors.append(sharedErrors);
if ( !feedback->isCanceled() )
emit topologyChecksUpdated( layer, sharedErrors );

@@ -96,7 +96,7 @@ class QgsGeometryValidationService : public QObject
QList< QgsGeometryCheck *> topologyChecks;
QFutureWatcher<void> *topologyCheckFutureWatcher = nullptr;
QList<QgsFeedback *> topologyCheckFeedbacks; // will be deleted when topologyCheckFutureWatcher is delteed
QList<QgsGeometryCheckError *> topologyCheckErrors;
QList<std::shared_ptr<QgsGeometryCheckError>> topologyCheckErrors;
QList<QMetaObject::Connection> connections;
QgsGeometryCheckContext *context = nullptr;
};

0 comments on commit b0d8d8e

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