File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -60,8 +60,11 @@ void QgsProcessingProvider::refreshAlgorithms()
60
60
{
61
61
qDeleteAll ( mAlgorithms );
62
62
mAlgorithms .clear ();
63
- loadAlgorithms ();
64
- emit algorithmsLoaded ();
63
+ if ( isActive () )
64
+ {
65
+ loadAlgorithms ();
66
+ emit algorithmsLoaded ();
67
+ }
65
68
}
66
69
67
70
QList<const QgsProcessingAlgorithm *> QgsProcessingProvider::algorithms () const
Original file line number Diff line number Diff line change @@ -322,6 +322,12 @@ class DummyProvider : public QgsProcessingProvider
322
322
return supportsNonFileOutputs;
323
323
}
324
324
325
+ bool isActive () const override
326
+ {
327
+ return active;
328
+ }
329
+
330
+ bool active = true ;
325
331
bool *unloaded = nullptr ;
326
332
bool supportsNonFileOutputs = false ;
327
333
@@ -972,6 +978,16 @@ void TestQgsProcessing::algorithm()
972
978
QCOMPARE ( providerRefreshed.count (), 2 + i );
973
979
}
974
980
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
+
975
991
QgsProcessingRegistry r;
976
992
r.addProvider ( p );
977
993
QCOMPARE ( r.algorithms ().size (), 2 );
You can’t perform that action at this time.
0 commit comments