[QGIS-Developer] Safely interact with loaded layers in Processing algorithms

matteo matteo.ghetta at gmail.com
Fri Oct 30 06:32:02 PDT 2020


Hi devs,

I noticed that using in a Processing script something like:

project = context.project()

mylist = []

for layer in project.mapLayers().values():
     mylist.append(layer)
     # do whatever you like to do

might be NOT safe, or at least QGIS (3.10, 3.14) sometime crashes:

[Inferior 1 (process 24944) detached]
gdb returned 0
Aborted


Is this the correct way to do it or is there some more Processing 
oriented ways?

Cheers and thanks

Matteo



More information about the QGIS-Developer mailing list