Skip to content

Commit

Permalink
Fix crash when removing layer with attribute table open
Browse files Browse the repository at this point in the history
Fix #19054
  • Loading branch information
m-kuhn committed Jun 4, 2018
1 parent e5e966b commit fcb6a74
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/gui/attributetable/qgsfeaturelistview.cpp
Expand Up @@ -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 )
Expand All @@ -423,7 +428,9 @@ void QgsFeatureListView::ensureEditSelection( bool inSelection )
rowToSelect = 0;

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

0 comments on commit fcb6a74

Please sign in to comment.