From 6b7852c2bb9d6167a9d10d0e59a018ed76321021 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 16 Apr 2024 11:03:27 +0200 Subject: [PATCH] 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 --- pcbnew/board.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pcbnew/board.cpp b/pcbnew/board.cpp index d5888e2bf1..5fbdc97fd1 100644 --- a/pcbnew/board.cpp +++ b/pcbnew/board.cpp @@ -1240,7 +1240,11 @@ void BOARD::DeleteMARKERs() { // the vector does not know how to delete the PCB_MARKER, it holds pointers for( PCB_MARKER* marker : m_markers ) + { + // We also must clear the cache + m_itemByIdCache.erase( marker->m_Uuid ); delete marker; + } m_markers.clear(); } @@ -1256,6 +1260,8 @@ void BOARD::DeleteMARKERs( bool aWarningsAndErrors, bool aExclusions ) if( ( marker->GetSeverity() == RPT_SEVERITY_EXCLUSION && aExclusions ) || ( marker->GetSeverity() != RPT_SEVERITY_EXCLUSION && aWarningsAndErrors ) ) { + // We also must clear the cache + m_itemByIdCache.erase( marker->m_Uuid ); delete marker; } else