Skip to content

Commit fcb6a74

Browse files
committed
Fix crash when removing layer with attribute table open
Fix #19054
1 parent e5e966b commit fcb6a74

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/gui/attributetable/qgsfeaturelistview.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,11 @@ void QgsFeatureListView::ensureEditSelection( bool inSelection )
400400
{
401401
QTimer::singleShot( 0, this, [ this, inSelection, validEditSelectionAvailable ]()
402402
{
403+
// The layer might have been removed between timer start and timer triggered
404+
// in this case there is nothing left for us to do.
405+
if ( !layerCache() )
406+
return;
407+
403408
int rowToSelect = -1;
404409

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

425430
if ( rowToSelect != -1 )
431+
{
426432
setEditSelection( mModel->mapToMaster( mModel->index( rowToSelect, 0 ) ), QItemSelectionModel::ClearAndSelect );
433+
}
427434
} );
428435
}
429436
}

0 commit comments

Comments
 (0)