Bug report #15737
Editing a form opened via openFeatureForm crashes qgis
Status: | Closed | ||
---|---|---|---|
Priority: | Severe/Regression | ||
Assignee: | - | ||
Category: | Forms | ||
Affected QGIS version: | master_2 | Regression?: | No |
Operating System: | Easy fix?: | No | |
Pull Request or Patch supplied: | No | Resolution: | |
Crashes QGIS or corrupts data: | Yes | Copied to github as #: | 23659 |
Description
Hi,
on 2.16.3 (either compiled or from binaries) and master 7d00cae4bbb723aaf4a2c1e51a9a485c402bc180 (23th of september)
I open a form using openFeatureForm(layer, feature) from python action. Validating the form will crash qgis at first attempt.
This is NOT related to UI form, I get the crash with Autogenerated or drag and drop form.
Python action definition used to launch the edit form is:
registry = QgsMapLayerRegistry.instance() layer = registry.mapLayer('[% @layer_id %]') request = QgsFeatureRequest().setFilterFid([% $id %]) feature = next(layer.getFeatures(request)) qgis.utils.iface.openFeatureForm(layer, feature, 0, 1)
Using Hotlink plugin to trigger the same action leads to the same too.
gdb trace here : [[http://pastebin.com/LC0KaW5q]]
a sample project + data to reproduce is attached to the ticket
I declare it as regression since it has been working since early 2.x for me.
Associated revisions
Don't delete QgsAttributeDialog too early. Fixes #15737
Don't delete QgsAttributeDialog too early. Fixes #15737
(cherry picked from commit 9ecdf6101433)
Don't delete QgsAttributeDialog too early. Fixes #15737
History
#1 Updated by Regis Haubourg about 8 years ago
It seems that only osgeo4w is not affected
#2 Updated by Hugo Mercier about 8 years ago
If you call openFeatureForm with modal = False, it does not crash
qgis.utils.iface.openFeatureForm(layer, feature, False, False)
#3 Updated by Regis Haubourg about 8 years ago
Confirmed!
you gave me a nice workaround, thanks.
#4 Updated by Hugo Mercier about 8 years ago
Ok, there is something strange around QgsAttributeDialog::show that is overloaded. It forces the dialog to be deleted on closing.
Then when the feature is accessed, the dialog is dead.
https://github.com/qgis/QGIS/blob/master/src/app/qgsfeatureaction.cpp#L125
#5 Updated by Hugo Mercier about 8 years ago
- Status changed from Open to Closed
Fixed in changeset 91661421814df138aa62a092aed0573e01840ea7.