Bug report #15737
Editing a form opened via openFeatureForm crashes qgis
|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|
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.
Don't delete QgsAttributeDialog too early. Fixes #15737
(cherry picked from commit 9ecdf6101433)
#4 Updated by Hugo Mercier about 4 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.