Skip to content

Commit 285bb06

Browse files
committedJan 28, 2018
[processing] Fix duplicate parameter
And throw warnings when other duplicate parameters are registered. GRASS has a lot.
1 parent 7e20fe4 commit 285bb06

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed
 

‎src/analysis/processing/qgsalgorithmuniquevalueindex.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ void QgsAddUniqueValueIndexAlgorithm::initAlgorithm( const QVariantMap & )
6262
classedOutput->setCreateByDefault( true );
6363
addParameter( classedOutput.release() );
6464

65-
addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "OUTPUT" ), QObject::tr( "Layer with index field" ), QgsProcessing::TypeVector, QVariant(), true ) );
66-
6765
std::unique_ptr< QgsProcessingParameterFeatureSink > summaryOutput = qgis::make_unique< QgsProcessingParameterFeatureSink >( QStringLiteral( "SUMMARY_OUTPUT" ), QObject::tr( "Class summary" ),
6866
QgsProcessing::TypeVector, QVariant(), true );
6967
summaryOutput->setCreateByDefault( false );

‎src/core/processing/qgsprocessingalgorithm.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,10 @@ bool QgsProcessingAlgorithm::addParameter( QgsProcessingParameterDefinition *def
244244

245245
// check for duplicate named parameters
246246
if ( QgsProcessingAlgorithm::parameterDefinition( definition->name() ) )
247+
{
248+
QgsLogger::warning( QStringLiteral( "Duplicate parameter %1 registered for alg %2" ).arg( definition->name(), id() ) );
247249
return false;
250+
}
248251

249252
if ( definition->isDestination() && mProvider )
250253
{

‎src/core/processing/qgsprocessingprovider.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,10 @@ bool QgsProcessingProvider::addAlgorithm( QgsProcessingAlgorithm *algorithm )
7575
return false;
7676

7777
if ( mAlgorithms.contains( algorithm->name() ) )
78+
{
79+
QgsLogger::warning( QStringLiteral( "Duplicate algorithm name %1 for provider %2" ).arg( algorithm->name(), id() ) );
7880
return false;
81+
}
7982

8083
// init the algorithm - this allows direct querying of the algorithm's parameters
8184
// and outputs from the provider's copy

0 commit comments

Comments
 (0)
Please sign in to comment.