[Qgis-developer] crash with undo command

Nejia nejia at spaceyes.fr
Wed Sep 24 08:08:36 PDT 2014


Hi,

 

I have a plugin that allows to change an attribute value of added feature to
the selected value of a combo-box.

I change the attribute when the signal "featureAdded" is emmited (ie. Before
the endEditCommand of "add feature" is called) so in this undo command we
have in the order:

1-  QgsVectorLayerUndoCommandAddFeature

2-      QgsVectorLayerUndoCommandChangeAttribute

 

If we undo "add feature" command it must call undo() on all child commands
in reverse order, but when I debug in QGIS it do it in the order not in
reverse order ie. It call:

1-  QgsVectorLayerUndoCommandAddFeature::undo()

2-      QgsVectorLayerUndoCommandChangeAttribute::undo()

 

That's why Qgis crash when I undo "add feature" command

An explanation for this?

 

Is there any way to knew if the signal "feature added" is emitted when a new
feature is added not from commitChanges(), redoEditCommand() and
undoEditCommand()?

 

Thank you

Nejia

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20140924/02c1bbeb/attachment.html>


More information about the Qgis-developer mailing list