Skip to content
Permalink
Browse files

Fix crash when closing docked attribute table

Fix #14909
Fix #15018

git bisect is your friend
  • Loading branch information
m-kuhn committed Jun 14, 2016
1 parent df6d2c6 commit a05b2ad9a1ace292e77dbe8541240c0c8bc2a096
@@ -139,10 +139,9 @@ void QgsAttributeTableView::setModel( QgsAttributeTableFilterModel* filterModel
connect( mFeatureSelectionModel, SIGNAL( requestRepaint( QModelIndexList ) ), this, SLOT( repaintRequested( QModelIndexList ) ) );
connect( mFeatureSelectionModel, SIGNAL( requestRepaint() ), this, SLOT( repaintRequested() ) );

delete mActionWidget;
mActionWidget = createActionWidget( 0 );
mActionWidget.reset( createActionWidget( 0 ) );
mActionWidget->setVisible( false );
updateActionImage( mActionWidget );
updateActionImage( mActionWidget.data() );
}
}

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

if ( attributeTableConfig.actionWidgetStyle() == QgsAttributeTableConfig::DropDown )
{
toolButton = new QToolButton( this );
toolButton = new QToolButton();
toolButton->setPopupMode( QToolButton::MenuButtonPopup );
container = toolButton;
}
else
{
container = new QWidget( this );
container = new QWidget();
container->setLayout( new QHBoxLayout() );
container->layout()->setMargin( 0 );
}
@@ -400,7 +399,7 @@ void QgsAttributeTableView::columnSizeChanged( int index, int oldWidth, int newW
if ( mFilterModel->actionColumnIndex() == index )
{
mActionWidget->resize( newWidth, mActionWidget->height() );
updateActionImage( mActionWidget );
updateActionImage( mActionWidget.data() );
}
emit columnResized( index, newWidth );
}
@@ -170,7 +170,7 @@ class GUI_EXPORT QgsAttributeTableView : public QTableView
QMenu *mActionPopup;
int mRowSectionAnchor;
QItemSelectionModel::SelectionFlag mCtrlDragSelectionFlag;
QWidget* mActionWidget;
QScopedPointer<QWidget> mActionWidget;
};

#endif

4 comments on commit a05b2ad

@nirvn

This comment has been minimized.

Copy link
Contributor

nirvn replied Jun 14, 2016

!

@nyalldawson

This comment has been minimized.

Copy link
Contributor

nyalldawson replied Jun 14, 2016

@m-kuhn I'm curious about this.... I can't see anything wrong with the original approach, so this is just working around a qt bug, right?

@m-kuhn

This comment has been minimized.

Copy link
Member Author

m-kuhn replied Jun 14, 2016

Yes, I really don't understand what actually has gone wrong.
The combination of a child widget which is not rendered on the parent plus embedding in a dock somehow caused a double delete.

See also https://hub.qgis.org/issues/14909#note-7

@nyalldawson

This comment has been minimized.

Copy link
Contributor

nyalldawson replied Jun 14, 2016

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