-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Attributetable fixes crash #16492 #4535
Conversation
@@ -93,6 +93,13 @@ void QgsAttributeTableDelegate::setModelData( QWidget *editor, QAbstractItemMode | |||
if ( !eww ) | |||
return; | |||
|
|||
// This fixes https://issues.qgis.org/issues/16492 | |||
if ( ! vl->getFeature( fid ).isValid( ) ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For speed you could tighten up this request a lot - fetch no geometry or attributes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll do, thanks.
@3nids any idea about what's going on here? https://travis-ci.org/qgis/QGIS/jobs/231445942#L283 it sais that |
What's the underlying issue here? Is it that the model doesn't get correctly updated when the feature is deleted? |
The problem is that The second call to |
hi @nyalldawson I fond this bug/regression during Essen, The problem is that selected row in AttributeTable trigger the editing of the first cell of the last selected row! something that can't be avoided (I tried all combination of trigger events possibilities). Then inf the selected rows are deleted and the editing delegate of the cell is still active => the row will be triggered for removing and at the same time an update raw will be triggered but working on a misaligned model, or at least the model index is not valid. |
@elpaso did you try if the modelIndex is still valid? or the index is valid but the feature is already removed befiore the model update? |
@luipir yes, that's the first thing I checked, the index is valid even if the feature has been already deleted. |
@m-kuhn @nyalldawson any idea if we should fix the model to avoid to have valid index on disappeared data? |
Where exactly? Can it be avoided that it's called two times? |
that was my intention with the patch: without the check for a valid feature, the function will proceed with editing the attributes (on a deleted feature!) in As I mentioned in #4535 (comment) , here we have two edit actions: the deletion of the selected feature and the editing of an attribute on one of those (because the editor was active), but the second action (the attribute editing) is applied after the selected features have been removed. So, when the selected features are removed So, it seems to me that preventing the second (attribute) edit on the deleted feature/row is the right fix. |
What about connecting the editor to the This would get rid of a (potentially expensive) additional request. |
I didn't try that way.
Maybe I should just move the check inside the |
@m-kuhn done with latest commit |
Fixes https://issues.qgis.org/issues/16492
The proposed solution is to check for feature validity before editing the attributes.
The problem arises when in the attr-table selected features are deleted while one attribute editor is active.
Needs-backporting
The three other commits are just minor typos and one added comment.