Skip to content

Commit 3d8dd49

Browse files
committed
Fix crash in attribute table when action column is visible and edit is
toggled
1 parent 1efb3cb commit 3d8dd49

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/gui/attributetable/qgsattributetableview.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -449,14 +449,13 @@ void QgsAttributeTableView::onActionColumnItemPainted( const QModelIndex &index
449449

450450
void QgsAttributeTableView::recreateActionWidgets()
451451
{
452-
QMap< QModelIndex, QWidget * > newWidgets;
453452
QMap< QModelIndex, QWidget * >::const_iterator it = mActionWidgets.constBegin();
454453
for ( ; it != mActionWidgets.constEnd(); ++it )
455454
{
456-
it.value()->deleteLater(); //?
457-
QWidget *widget = createActionWidget( mFilterModel->data( it.key(), QgsAttributeTableModel::FeatureIdRole ).toLongLong() );
458-
newWidgets.insert( it.key(), widget );
459-
setIndexWidget( it.key(), widget );
455+
// ownership of widget was transferred by initial call to setIndexWidget - clearing
456+
// the index widget will delete the old widget safely
457+
// they should then be recreated by onActionColumnItemPainted
458+
setIndexWidget( it.key(), nullptr );
460459
}
461-
mActionWidgets = newWidgets;
460+
mActionWidgets.clear();
462461
}

0 commit comments

Comments
 (0)