[Qgis-developer] Segmentation fault when using layersRemoved SIGNAL.

Germán Carrillo carrillo.german at gmail.com
Mon Jun 13 13:53:51 PDT 2016


Hi All,

there seems to be an issue connecting the SIGNAL layersRemoved from
QgsMapLayerRegistry.

For example, if I save this script to a file, and run it from the Linux
terminal:

################################################
import unittest
from qgis.core import QgsApplication, QgsMapLayerRegistry

class SIGNALTest( unittest.TestCase ):

    def setUp( self ):
        app = QgsApplication([], True)
        QgsApplication.setPrefixPath("/usr", True)
        QgsApplication.initQgis()

        QgsMapLayerRegistry.instance().layersRemoved.connect(
self.myFunction )

    def myFunction( self, layerIds ):
        print "Called!"

    def test1( self ):
        self.assertEqual(1,1)

    def tearDown( self ):
        QgsApplication.exitQgis()

if __name__ == "__main__":
    unittest.main()
################################################

I get the following result:

##########
Called!
.
----------------------------------------------------------------------
Ran 1 test in 0.119s

OK
Segmentation fault
###########

If, on the contrary, I comment out the line where the connection is set or
if I use other signals such as layerRemoved or layersAdded instead of
layersRemoved, I get:

###########
.
----------------------------------------------------------------------
Ran 1 test in 0.111s

OK
###########

I'm using QGIS 2.14.2 on a GNU/Linux machine.

Can you confirm such problem? Do you have any clue about it?


Regards,

Germán

-- 
-----------
   |\__
(:>__)(
   |/
Soluciones Geoinformáticas Libres
http://geotux.tuxfamily.org/
http://twitter.com/GeoTux2
http://about.me/germancarrillo

<http://gis.stackexchange.com/users/4972/germ%c3%a1n-carrillo>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20160613/4e005a5c/attachment.html>


More information about the Qgis-developer mailing list