Bug report #12676
Subforms with Python init function crash when adding values
|Affected QGIS version:||master||Regression?:||No|
|Operating System:||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||20783|
I am not anymore able to use subforms (based on project relations) which have a Python init function.
When trying to add values (or even cancelling new values), I've got a Python error dialog box:
An error occured during execution of following code: del _qgis_layer_ILL_PAE20150202141820409 Traceback (most recent call last): File "", line 1, in NameError: name '_qgis_layer_ILL_PAE20150202141820409' is not defined
It seems that QGIS is trying to call an already deleted (or not already created) Python variable.
When I add new objects on the subform, I've got another error text:
An error occured during execution of following code: DBPAT_FULL.testSub( _qgis_featureform_27, _qgis_layer_ILL_PAE20150202141820409, _qgis_feature_20150430144850051) Traceback (most recent call last): File "", line 1, in NameError: name '_qgis_layer_ILL_PAE20150202141820409' is not defined
This time it is launching my Python init fuction (named testSub) with an invalid reference to the layer...
It is not a blocker because you are able to add new lins to subforms. But the error dialog is always triggered when you close the parent form which is very annoying for end users.
The problem doesn't seem to come from the Python init function code because I've got the error dialog even with the following trivial function:
def testSub(dialog, layerid, featureid): QgsMessageLog.logMessage(u"testSub !", "DBPAT", QgsMessageLog.INFO)
When there is no Python init function, there is no error !
For me it is very annoying as it was not present in 2.6.1. QGIS 2.8.1 and master (well, nightly-build) are affected...
Thanks for (trying) to fix this bug...