Skip to content

Commit 21605a1

Browse files
committed
[processing] Don't try to load algorithms for disabled providers
Fixes #18488 (cherry-picked from 9ab4d96)
1 parent e70982a commit 21605a1

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

src/core/processing/qgsprocessingprovider.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,11 @@ void QgsProcessingProvider::refreshAlgorithms()
6060
{
6161
qDeleteAll( mAlgorithms );
6262
mAlgorithms.clear();
63-
loadAlgorithms();
64-
emit algorithmsLoaded();
63+
if ( isActive() )
64+
{
65+
loadAlgorithms();
66+
emit algorithmsLoaded();
67+
}
6568
}
6669

6770
QList<const QgsProcessingAlgorithm *> QgsProcessingProvider::algorithms() const

tests/src/analysis/testqgsprocessing.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,12 @@ class DummyProvider : public QgsProcessingProvider
322322
return supportsNonFileOutputs;
323323
}
324324

325+
bool isActive() const override
326+
{
327+
return active;
328+
}
329+
330+
bool active = true;
325331
bool *unloaded = nullptr;
326332
bool supportsNonFileOutputs = false;
327333

@@ -972,6 +978,16 @@ void TestQgsProcessing::algorithm()
972978
QCOMPARE( providerRefreshed.count(), 2 + i );
973979
}
974980

981+
// inactive provider, should not load algorithms
982+
p->active = false;
983+
p->refreshAlgorithms();
984+
QCOMPARE( providerRefreshed.count(), 3 );
985+
QVERIFY( p->algorithms().empty() );
986+
p->active = true;
987+
p->refreshAlgorithms();
988+
QCOMPARE( providerRefreshed.count(), 4 );
989+
QVERIFY( !p->algorithms().empty() );
990+
975991
QgsProcessingRegistry r;
976992
r.addProvider( p );
977993
QCOMPARE( r.algorithms().size(), 2 );

0 commit comments

Comments
 (0)