Avoid loss of data when saving a board having duplicate UUID

Some  (old) boards used for panelisation can have duplicate UUID
(timestamp). duplicate timestamps create loss of data when saving these boards.

Fixes #5969
https://gitlab.com/kicad/code/kicad/issues/5969
This commit is contained in:
jean-pierre charras 2020-10-11 19:02:38 +02:00
parent 7fb767653c
commit 57da733f56
3 changed files with 16 additions and 4 deletions

View File

@ -144,7 +144,10 @@ bool BOARD_ITEM::ptr_cmp::operator() ( const BOARD_ITEM* a, const BOARD_ITEM* b
if( a->GetLayer() != b->GetLayer() )
return a->GetLayer() < b->GetLayer();
return a->m_Uuid < b->m_Uuid;
if( a->m_Uuid != b->m_Uuid ) // shopuld be always the case foer valid boards
return a->m_Uuid < b->m_Uuid;
return a < b;
}

View File

@ -1755,7 +1755,10 @@ bool MODULE::cmp_drawings::operator()( const BOARD_ITEM* aFirst, const BOARD_ITE
return dwgA->GetShape() < dwgB->GetShape();
}
return aFirst->m_Uuid < aSecond->m_Uuid;
if( aFirst->m_Uuid != aSecond->m_Uuid ) // shopuld be always the case foer valid boards
return aFirst->m_Uuid < aSecond->m_Uuid;
return aFirst < aSecond;
}
@ -1764,7 +1767,10 @@ bool MODULE::cmp_pads::operator()( const D_PAD* aFirst, const D_PAD* aSecond ) c
if( aFirst->GetName() != aSecond->GetName() )
return StrNumCmp( aFirst->GetName(), aSecond->GetName() ) < 0;
return aFirst->m_Uuid < aSecond->m_Uuid;
if( aFirst->m_Uuid != aSecond->m_Uuid ) // shopuld be always the case foer valid boards
return aFirst->m_Uuid < aSecond->m_Uuid;
return aFirst < aSecond;
}

View File

@ -968,7 +968,10 @@ bool TRACK::cmp_tracks::operator() ( const TRACK* a, const TRACK* b ) const
if( a->Type() != b->Type() )
return a->Type() < b->Type();
return a->m_Uuid < b->m_Uuid;
if( a->m_Uuid != b->m_Uuid )
return a->m_Uuid < b->m_Uuid;
return a < b;
}