Skip to content

Commit 9ab4d96

Browse files
committed
[processing] Don't try to load algorithms for disabled providers
Fixes #18488
1 parent fadf0b1 commit 9ab4d96

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
@@ -323,6 +323,12 @@ class DummyProvider : public QgsProcessingProvider
323323
return supportsNonFileOutputs;
324324
}
325325

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

@@ -1079,6 +1085,16 @@ void TestQgsProcessing::algorithm()
10791085
QCOMPARE( providerRefreshed.count(), 2 + i );
10801086
}
10811087

1088+
// inactive provider, should not load algorithms
1089+
p->active = false;
1090+
p->refreshAlgorithms();
1091+
QCOMPARE( providerRefreshed.count(), 3 );
1092+
QVERIFY( p->algorithms().empty() );
1093+
p->active = true;
1094+
p->refreshAlgorithms();
1095+
QCOMPARE( providerRefreshed.count(), 4 );
1096+
QVERIFY( !p->algorithms().empty() );
1097+
10821098
QgsProcessingRegistry r;
10831099
r.addProvider( p );
10841100
QCOMPARE( r.algorithms().size(), 2 );

0 commit comments

Comments
 (0)