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

QgsVectorLayer.committedFeaturesRemoved causes crash in Python #13426

Closed
qgib opened this issue Dec 22, 2010 · 3 comments
Closed

QgsVectorLayer.committedFeaturesRemoved causes crash in Python #13426

qgib opened this issue Dec 22, 2010 · 3 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Plugins
Milestone

Comments

@qgib
Copy link
Contributor

qgib commented Dec 22, 2010

Author Name: Chris Crook (@ccrook)
Original Redmine Issue: 3366

Redmine category:python_plugins
Assignee: Borys Jurgiel


To replicate the problem ..

  1. Open a new QGis project

  2. Open a python console window

  3. Enter the following code

from [[PyQt]]4.QtCore import *
def handler():
    print "Deleting features"

1. Create a scratch layer and connect to committedFeaturesRemoved signal
type="Point"
name = "Test"
layer = [[QgsVectorLayer]](type, name, "memory")
[[QgsMapLayerRegistry]].instance().addMapLayer(layer)
qgis.utils.iface.mapCanvas().setCurrentLayer(layer)
QObject.connect(layer, SIGNAL("committedFeaturesRemoved(const QString &, const [[QgsFeatureIds]] & )"),handler)

This will create a layer called test

  1. Set the layer to be editable

  2. Add a point to the layer

  3. Commit the change (save the layer)

  4. Select the point

  5. Delete the point

  6. Commit the change - this causes the crash.

This happens consistently for me in QGis versions 1.6 and 1.7 r14962

Operating system is windows XP SP3

I've had a look at it as far as I can in the Visual Studio debugger. The crash appears to happen in the generated moc_.. file where the python signal is implemented, and the message is:

Unhandled exception at 0x0372ba7c in qgis.exe: 0xC000001E: An attempt was made to execute an invalid lock sequence.

@qgib
Copy link
Contributor Author

qgib commented Dec 22, 2010

Author Name: Chris Crook (@ccrook)


The line

def handler():

should probably read

def handler(arg1,arg2):

But it doesn't make any difference

@qgib
Copy link
Contributor Author

qgib commented Dec 27, 2010

Author Name: Martin Dobias (@wonder-sk)


When running the code in python console I get this (for the connect() call):

Traceback (most recent call last):
  File "<input>", line 1, in <module>
[[TypeError]]: type 'QgsFeatureIds' is not supported as a slot argument type

(this is sip v4.10.5 and pyqt v4.7.4)

It doesn't crash for me. I see several possible causes of your crash:

* the committed*(...) signals were not known by sip (they were added in qgis 1.6 but not also to pyqgis)

I have fixed both in 1d66171f (SVN r14979) - please give it another try with new trunk and close this bug if it works now.

Martin




@qgib
Copy link
Contributor Author

qgib commented Dec 28, 2010

Author Name: Chris Crook (@ccrook)


Brilliant.. thanks! This has fixed it (and I've set the status accordingly)

Looks like Windows doesn't handle this as well .. just dies when it can't handle the argument type.

Many thanks
Chris


  • resolution was configured as fixed
  • 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! Plugins labels May 24, 2019
@qgib qgib added this to the Version 1.7.0 milestone May 24, 2019
@qgib qgib closed this as completed May 24, 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! Plugins
Projects
None yet
Development

No branches or pull requests

1 participant