Skip to content
Permalink
Browse files

Fix crash in attribute table when action column is visible and edit is

toggled

(cherry-picked from 3d8dd49)
  • Loading branch information
nyalldawson committed Apr 2, 2018
1 parent 1d102b2 commit 5f1d3dbc743f913a3e135ac46a5d4cbd4773aaf9
Showing with 5 additions and 6 deletions.
  1. +5 −6 src/gui/attributetable/qgsattributetableview.cpp
@@ -449,14 +449,13 @@ void QgsAttributeTableView::onActionColumnItemPainted( const QModelIndex &index

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

0 comments on commit 5f1d3db

Please sign in to comment.
You can’t perform that action at this time.