Skip to content

Commit

Permalink
Fix memory management of errors
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Oct 15, 2018
1 parent 9c6c3aa commit b0d8d8e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/app/qgsgeometryvalidationservice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() );
Expand Down Expand Up @@ -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 );

Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsgeometryvalidationservice.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down

0 comments on commit b0d8d8e

Please sign in to comment.