Skip to content

Commit a05b2ad

Browse files
committed
Fix crash when closing docked attribute table
Fix #14909 Fix #15018 git bisect is your friend
1 parent df6d2c6 commit a05b2ad

2 files changed

Lines changed: 6 additions & 7 deletions

File tree

‎src/gui/attributetable/qgsattributetableview.cpp‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,9 @@ void QgsAttributeTableView::setModel( QgsAttributeTableFilterModel* filterModel
139139
connect( mFeatureSelectionModel, SIGNAL( requestRepaint( QModelIndexList ) ), this, SLOT( repaintRequested( QModelIndexList ) ) );
140140
connect( mFeatureSelectionModel, SIGNAL( requestRepaint() ), this, SLOT( repaintRequested() ) );
141141

142-
delete mActionWidget;
143-
mActionWidget = createActionWidget( 0 );
142+
mActionWidget.reset( createActionWidget( 0 ) );
144143
mActionWidget->setVisible( false );
145-
updateActionImage( mActionWidget );
144+
updateActionImage( mActionWidget.data() );
146145
}
147146
}
148147

@@ -167,13 +166,13 @@ QWidget* QgsAttributeTableView::createActionWidget( QgsFeatureId fid )
167166

168167
if ( attributeTableConfig.actionWidgetStyle() == QgsAttributeTableConfig::DropDown )
169168
{
170-
toolButton = new QToolButton( this );
169+
toolButton = new QToolButton();
171170
toolButton->setPopupMode( QToolButton::MenuButtonPopup );
172171
container = toolButton;
173172
}
174173
else
175174
{
176-
container = new QWidget( this );
175+
container = new QWidget();
177176
container->setLayout( new QHBoxLayout() );
178177
container->layout()->setMargin( 0 );
179178
}
@@ -400,7 +399,7 @@ void QgsAttributeTableView::columnSizeChanged( int index, int oldWidth, int newW
400399
if ( mFilterModel->actionColumnIndex() == index )
401400
{
402401
mActionWidget->resize( newWidth, mActionWidget->height() );
403-
updateActionImage( mActionWidget );
402+
updateActionImage( mActionWidget.data() );
404403
}
405404
emit columnResized( index, newWidth );
406405
}

‎src/gui/attributetable/qgsattributetableview.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ class GUI_EXPORT QgsAttributeTableView : public QTableView
170170
QMenu *mActionPopup;
171171
int mRowSectionAnchor;
172172
QItemSelectionModel::SelectionFlag mCtrlDragSelectionFlag;
173-
QWidget* mActionWidget;
173+
QScopedPointer<QWidget> mActionWidget;
174174
};
175175

176176
#endif

0 commit comments

Comments
 (0)