From b4f396bb2d60253ff600f8ca893f83b577f40c38 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Sun, 5 Oct 2025 05:40:23 -0700 Subject: [PATCH] Force clearing rtree when rebuilding Avoid leaving stale triangle references Fixes https://gitlab.com/kicad/code/kicad/issues/21896 --- pcbnew/connectivity/connectivity_items.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pcbnew/connectivity/connectivity_items.h b/pcbnew/connectivity/connectivity_items.h index 21151e0f85..9eeca92764 100644 --- a/pcbnew/connectivity/connectivity_items.h +++ b/pcbnew/connectivity/connectivity_items.h @@ -298,6 +298,8 @@ public: if( m_zone->IsTeardropArea() ) return; + m_rTree.RemoveAll(); + for( unsigned int ii = 0; ii < m_fillPoly->TriangulatedPolyCount(); ++ii ) { const auto* triangleSet = m_fillPoly->TriangulatedPolygon( ii );