From 78ec6bf8762b571f15c82bda2f3ef7bad5069f00 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Thu, 8 Jan 2026 19:03:16 +0100 Subject: [PATCH] Fix bug: matchItemsBySimilarity(): ensure pad numbers are taken in account This bug was responsible of clearing pad nets when updated footprints from lib. Fixes https://gitlab.com/kicad/code/kicad/-/issues/22625 --- pcbnew/pcb_edit_frame.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index f016f581d9..487d3390dd 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -2392,18 +2392,16 @@ static std::vector> matchItemsBySimilarity( const std::vector< double similarity = existing->Similarity( *updated ); - if( similarity <= 0.0 ) - continue; - - double score = similarity; - if constexpr( std::is_same_v ) { if( existing->GetNumber() == updated->GetNumber() ) - score += 2.0; + similarity += 2.0; } - candidates.push_back( { existing, updated, score } ); + if( similarity <= 0.0 ) + continue; + + candidates.push_back( { existing, updated, similarity } ); } }