BOARD::DeleteMARKERs fix bug: missing m_itemByIdCache handling.

When deleting markers, the m_itemByIdCache corresponding entry must be
also removed.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/11750
This commit is contained in:
jean-pierre charras 2024-04-16 11:03:27 +02:00
parent f61d400d88
commit 6b7852c2bb
1 changed files with 6 additions and 0 deletions

View File

@ -1240,7 +1240,11 @@ void BOARD::DeleteMARKERs()
{ {
// the vector does not know how to delete the PCB_MARKER, it holds pointers // the vector does not know how to delete the PCB_MARKER, it holds pointers
for( PCB_MARKER* marker : m_markers ) for( PCB_MARKER* marker : m_markers )
{
// We also must clear the cache
m_itemByIdCache.erase( marker->m_Uuid );
delete marker; delete marker;
}
m_markers.clear(); m_markers.clear();
} }
@ -1256,6 +1260,8 @@ void BOARD::DeleteMARKERs( bool aWarningsAndErrors, bool aExclusions )
if( ( marker->GetSeverity() == RPT_SEVERITY_EXCLUSION && aExclusions ) if( ( marker->GetSeverity() == RPT_SEVERITY_EXCLUSION && aExclusions )
|| ( marker->GetSeverity() != RPT_SEVERITY_EXCLUSION && aWarningsAndErrors ) ) || ( marker->GetSeverity() != RPT_SEVERITY_EXCLUSION && aWarningsAndErrors ) )
{ {
// We also must clear the cache
m_itemByIdCache.erase( marker->m_Uuid );
delete marker; delete marker;
} }
else else