mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Ensure hash ordering
Footprint elements are not guaranteed to be stably ordered, so sort the hashes before combining
This commit is contained in:
parent
f24aba4093
commit
b2039c1293
@ -35,6 +35,8 @@
|
|||||||
|
|
||||||
#include <macros.h>
|
#include <macros.h>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
#include <algorithm>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include <wx/log.h>
|
#include <wx/log.h>
|
||||||
|
|
||||||
@ -70,11 +72,18 @@ size_t hash_fp_item( const EDA_ITEM* aItem, int aFlags )
|
|||||||
if( aFlags & HASH_ROT )
|
if( aFlags & HASH_ROT )
|
||||||
hash_combine( ret, footprint->GetOrientation().AsDegrees() );
|
hash_combine( ret, footprint->GetOrientation().AsDegrees() );
|
||||||
|
|
||||||
|
std::vector<size_t> hashes;
|
||||||
|
|
||||||
for( BOARD_ITEM* item : footprint->GraphicalItems() )
|
for( BOARD_ITEM* item : footprint->GraphicalItems() )
|
||||||
hash_combine( ret, hash_fp_item( item, aFlags ) );
|
hashes.push_back( hash_fp_item( item, aFlags ) );
|
||||||
|
|
||||||
for( PAD* pad : footprint->Pads() )
|
for( PAD* pad : footprint->Pads() )
|
||||||
hash_combine( ret, hash_fp_item( static_cast<EDA_ITEM*>( pad ), aFlags ) );
|
hashes.push_back( hash_fp_item( static_cast<EDA_ITEM*>( pad ), aFlags ) );
|
||||||
|
|
||||||
|
std::sort( hashes.begin(), hashes.end() );
|
||||||
|
|
||||||
|
for( size_t h : hashes )
|
||||||
|
hash_combine( ret, h );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user