Skip to content
Permalink
Browse files

Fix crash when removing layer with attribute table open

Fix #19054
  • Loading branch information
m-kuhn committed Jun 4, 2018
1 parent e5e966b commit fcb6a74d2370b8b56c2e7637c062e61050829d09
Showing with 7 additions and 0 deletions.
  1. +7 −0 src/gui/attributetable/qgsfeaturelistview.cpp
@@ -400,6 +400,11 @@ void QgsFeatureListView::ensureEditSelection( bool inSelection )
{
QTimer::singleShot( 0, this, [ this, inSelection, validEditSelectionAvailable ]()
{
// The layer might have been removed between timer start and timer triggered
// in this case there is nothing left for us to do.
if ( !layerCache() )
return;

int rowToSelect = -1;

if ( inSelection )
@@ -423,7 +428,9 @@ void QgsFeatureListView::ensureEditSelection( bool inSelection )
rowToSelect = 0;

if ( rowToSelect != -1 )
{
setEditSelection( mModel->mapToMaster( mModel->index( rowToSelect, 0 ) ), QItemSelectionModel::ClearAndSelect );
}
} );
}
}

0 comments on commit fcb6a74

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