Fix symbol sorting routine to be determinant.
This commit is contained in:
parent
7d1dbb77c3
commit
a63025733a
|
@ -97,19 +97,23 @@ void SCH_SEXPR_PLUGIN_CACHE::Save( const std::optional<bool>& aOpt )
|
||||||
|
|
||||||
std::vector<LIB_SYMBOL*> orderedSymbols;
|
std::vector<LIB_SYMBOL*> orderedSymbols;
|
||||||
|
|
||||||
for( const std::pair<const wxString, LIB_SYMBOL*>& parent : m_symbols )
|
for( const auto& [ name, symbol ] : m_symbols )
|
||||||
orderedSymbols.push_back( parent.second );
|
{
|
||||||
|
if( symbol )
|
||||||
|
orderedSymbols.push_back( symbol );
|
||||||
|
}
|
||||||
|
|
||||||
// Library must be ordered by inheritance depth.
|
// Library must be ordered by inheritance depth.
|
||||||
std::sort( orderedSymbols.begin(), orderedSymbols.end(),
|
std::sort( orderedSymbols.begin(), orderedSymbols.end(),
|
||||||
[]( const LIB_SYMBOL* aLhs, const LIB_SYMBOL* aRhs )
|
[]( const LIB_SYMBOL* aLhs, const LIB_SYMBOL* aRhs )
|
||||||
{
|
{
|
||||||
wxCHECK( aLhs && aRhs, false );
|
unsigned int lhDepth = aLhs->GetInheritanceDepth();
|
||||||
|
unsigned int rhDepth = aRhs->GetInheritanceDepth();
|
||||||
|
|
||||||
if( aLhs->GetInheritanceDepth() < aRhs->GetInheritanceDepth() )
|
if( lhDepth == rhDepth )
|
||||||
return true;
|
return aLhs->GetName() < aRhs->GetName();
|
||||||
|
|
||||||
return aLhs->GetName() < aRhs->GetName();
|
return lhDepth < rhDepth;
|
||||||
} );
|
} );
|
||||||
|
|
||||||
for( LIB_SYMBOL* symbol : orderedSymbols )
|
for( LIB_SYMBOL* symbol : orderedSymbols )
|
||||||
|
|
Loading…
Reference in New Issue