Bug report #6547

QGIS segfaults when using Qgsvectorlayer.select() inside geometryChanged handler

Added by Rafael Varela about 12 years ago. Updated about 11 years ago.

Status:Closed
Priority:High
Assignee:-
Category:Vectors
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:Yes Copied to github as #:15751

Description

I'm developing a python plugin in QGIS 1.9.0-master that makes QGIS
segfault when I call Qgsvectorlayer.select() inside a geometryChanged
signal handler.

My code looks like this:

...

layer_A.geometryChanged.connect(self.onLineGeometryChange)

...

@pyqtSlot(int, QgsGeometry)
def onLineGeometryChange(self, featureId, geom ):
  ...
  layer_B.select( someRectangle, False )
  ...

QGIS only segfaults when using the node tool of mDigitizeToolBar. It does not crash when I use the move feature tool.

Looking at the source code in the git repository I found out that most of the Qgsvectorlayer::select() functionality resides in the select() functions of the data provider, so I decided to write the layers to disk and switch the layer data provider from "memory" to "ogr".

Unfortunately, the problem still persists.

FixSelect.tar.gz (14.1 KB) Daniel Vaz, 2013-07-14 12:11 PM

History

#1 Updated by Giovanni Manghi almost 12 years ago

  • Priority changed from Normal to High

#2 Updated by Daniel Vaz over 11 years ago

I create a test plugin that do nothing, except for connect the same signal and try to select something in the active layer. The plugin works fine.

I am used a shape layer and node tool (from mDigitizeToolBar) and move tool, too.

Nothing crash.

Are you sure about the existence of layer_B when some feature of layer_A was changed?

I look forward to hear you soon.

#3 Updated by Daniel Vaz over 11 years ago

Steps to use the plugin

1 - Open Qgis
2 - Insert a existent shape layer
3 - Select the layer
4 - Run the plugin
5 - Click in button "1" that connect signal (geometryChanged) to slot
6 - Go to edit mode
7 - Use node tool or move tool in selected layer

Works fine.

#4 Updated by Jürgen Fischer over 11 years ago

  • Category set to Vectors

#5 Updated by Rafael Varela over 11 years ago

Daniel Vaz wrote:

I create a test plugin that do nothing, except for connect the same signal and try to select something in the active layer. The plugin works fine.

I am used a shape layer and node tool (from mDigitizeToolBar) and move tool, too.

Nothing crash.

Are you sure about the existence of layer_B when some feature of layer_A was changed?

Well, I'm pretty sure that layer_B existed when I did my tests, but I will check it again with the current "master". I still have to upgrade my installation to run your plugin.

Bear in mind that this report is 9 months old and things may have changed a lot from the code revision I used (probably, fb7c596 from OSGeo4W package 1.9.0-227)

Thank you for your interest in this issue.

#6 Updated by Daniel Vaz over 11 years ago

You are right.

A long time has passed since you post it. Probably the SIP was broken when you report the bug.

Thanks

#7 Updated by Giovanni Manghi over 11 years ago

  • Status changed from Open to Feedback

#8 Updated by Matthias Kuhn about 11 years ago

  • Status changed from Feedback to Closed

Closed due to lack of feedback.
Please reopen if required and add any data/info that may have been requested.

Also available in: Atom PDF