Skip to content

Commit 4f82b0b

Browse files
committed
[bugfix] Attribute table crashes QGIS when deleting selected
Fixes https://issues.qgis.org/issues/16492 Backport from #4535
1 parent 9149ffb commit 4f82b0b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/gui/attributetable/qgsattributetabledelegate.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,18 @@ void QgsAttributeTableDelegate::setModelData( QWidget *editor, QAbstractItemMode
9494
if ( !eww )
9595
return;
9696

97+
// This fixes https://issues.qgis.org/issues/16492
98+
QgsFeatureRequest request( fid );
99+
request.setFlags( QgsFeatureRequest::NoGeometry );
100+
request.setSubsetOfAttributes( QgsAttributeList( ) );
101+
QgsFeature feature;
102+
vl->getFeatures( request ).nextFeature( feature );
103+
if ( ! feature.isValid( ) )
104+
{
105+
// Model is out of sync (again!).
106+
return;
107+
}
108+
97109
newValue = eww->value();
98110

99111
if (( oldValue != newValue && newValue.isValid() ) || oldValue.isNull() != newValue.isNull() )

0 commit comments

Comments
 (0)