Remove DRC exclusions that no longer have items.

Fixes https://gitlab.com/kicad/code/kicad/issues/13802
This commit is contained in:
Jeff Young 2023-02-07 18:25:18 +00:00
parent 7bc79c17d4
commit 13391176ae
2 changed files with 15 additions and 4 deletions

View File

@ -316,6 +316,20 @@ std::vector<PCB_MARKER*> BOARD::ResolveDRCExclusions()
{ {
PCB_MARKER* marker = PCB_MARKER::Deserialize( exclusionData ); PCB_MARKER* marker = PCB_MARKER::Deserialize( exclusionData );
if( !marker )
continue;
// Check to see if items still exist
for( const KIID& guid : marker->GetRCItem()->GetIDs() )
{
if( GetItem( guid ) == DELETED_BOARD_ITEM::GetInstance() )
{
delete marker;
marker = nullptr;
break;
}
}
if( marker ) if( marker )
{ {
marker->SetExcluded( true ); marker->SetExcluded( true );

View File

@ -987,10 +987,7 @@ void PCB_EDIT_FRAME::ResolveDRCExclusions()
for( PCB_MARKER* marker : GetBoard()->Markers() ) for( PCB_MARKER* marker : GetBoard()->Markers() )
{ {
if( marker->GetSeverity() == RPT_SEVERITY_EXCLUSION ) if( marker->GetSeverity() == RPT_SEVERITY_EXCLUSION )
{ GetCanvas()->GetView()->Update( marker );
GetCanvas()->GetView()->Remove( marker );
GetCanvas()->GetView()->Add( marker );
}
} }
GetBoard()->UpdateRatsnestExclusions(); GetBoard()->UpdateRatsnestExclusions();