Thanks a lot for those fast and accurate suggestions. We try to do as you propose and post the result here!
Many thanks, Rémi-C 2015-02-12 18:07 GMT+01:00 Martin Dobias <[email protected]>: > Hi again Remi > > On Thu, Feb 12, 2015 at 11:46 PM, Rémi Cura <[email protected]> wrote: > >> Hello again dear list, >> >> Our goal is to save (commitchanges) any modification of a vector layer >> when it happens. >> >> >> We encountered another problem when trying to exploit the >> layer.geometryChanged event. >> >> Upon activation of this event, we tried to use the layer.commitChanges() >> to save changes in geometry of the layer (postgis layer, maybe not >> related), >> >> But it hard-crashes QGIS. >> A quick gdb look seems to indicate a rollback issue?? >> > > It is not a good idea to try to commit changes in a slot connected to a > signal about layer modification - crashes due to corrupted undo stack can > be expected (the undo stack is not in final state yet at the time of the > signal being emitted). Also often the changes are done in batches (e.g. > field calculator) and if you committed changes after each single change, > this may lead to poor performance due to separate transactions. > > I think for your use case you could watch changes to the undo stack and > commit whenever you detect a new undo command is added (e.g. > canUndoChanged() or indexChanged() signal) you could commit the changes. > > Regards > Martin > >
_______________________________________________ Qgis-developer mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/qgis-developer
