[Qgis-developer] commit change in geometry produce fatal error

Rémi Cura remi.cura at gmail.com
Thu Feb 12 09:11:11 PST 2015


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 <wonder.sk at gmail.com>:

> Hi again Remi
>
> On Thu, Feb 12, 2015 at 11:46 PM, Rémi Cura <remi.cura at gmail.com> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20150212/47786f79/attachment-0001.html>


More information about the Qgis-developer mailing list