Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault when using layersRemoved SIGNAL #23030

Closed
qgib opened this issue Jun 20, 2016 · 2 comments
Closed

Segmentation fault when using layersRemoved SIGNAL #23030

qgib opened this issue Jun 20, 2016 · 2 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Vectors Related to general vector layer handling (not specific data formats)
Milestone

Comments

@qgib
Copy link
Contributor

qgib commented Jun 20, 2016

Author Name: gcarrillo - (gcarrillo -)
Original Redmine Issue: 15088
Affected QGIS version: 2.14.2
Redmine category:vectors


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.

@qgib
Copy link
Contributor Author

qgib commented Jun 23, 2016

Author Name: René-Luc ReLuc (@rldhont)


We encountered the same behavoir on QGIS Server.

The crash is due to QgsEditorWidgetRegistry::mapLayerWillBeRemoved when the cast is done QgsVectorLayer* vl = qobject_cast<QgsVectorLayer*>( mapLayer ); QGIS crashed.


  • fixed_version_id was changed from Future Release - Lower Priority to Version 2.14
  • priority_id was changed from Normal to Severe/Regression
  • category_id was changed from Python plugins to Vectors

@qgib
Copy link
Contributor Author

qgib commented Jun 26, 2016

Author Name: Anónimo (Anónimo)


Fixed in changeset "4b0df5bc5b71523ad35db050c57ca3c04c2b6d1e".


  • status_id was changed from Open to Closed

@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! Vectors Related to general vector layer handling (not specific data formats) labels May 25, 2019
@qgib qgib added this to the Version 2.14 milestone May 25, 2019
@qgib qgib closed this as completed May 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Vectors Related to general vector layer handling (not specific data formats)
Projects
None yet
Development

No branches or pull requests

1 participant