Hi Manuel On Fri, Mar 4, 2016 at 10:05 PM, Manuel Hernández Martínez <mhernand...@agenciamedioambienteyagua.es> wrote: > > self.iface.mapCanvas().currentLayer().featureAdded.connect(self._debug_onFeatureAdded) > > def _debug_onFeatureAdded(self, fid): > layer = self.iface.mapCanvas().currentLayer() > layer.beginEditCommand("Set UUID") > print layer.changeAttributeValue(fid, > layer.fieldNameIndex('guid_pol'), 'some_random_uuid') # prints True > layer.endEditCommand() > > [...] > > When I edit the layer, if I add a feature the field 'guid_pol' is set to > 'some_random_uuid' as expected. I can commit the changes without a problem, > however if instead of committing the changes I try cancelling them QGIS > crashes with error 0xC0000005 (Access Violation).
Unfortunately this is currently a limitation of our current editing system... When an editing signal (like "featureAdded") is emitted, doing some extra editing actions will corrupt the undo stack because the undo command of the previous action is not yet finished. A possible workaround could be to use queued signal/slot connection instead of direct connection (which is the default), so the slot execution will be delayed, and the undo stack will get to a consistent state. Regards Martin _______________________________________________ Qgis-developer mailing list Qgis-developer@lists.osgeo.org List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer