Fix some asserts with the property system

It seems like there may be some race between BOARD_CONNECTED_ITEM_DESC
and BOARD_ITEM_DESC

https://gitlab.com/kicad/code/kicad/-/issues/4816
This commit is contained in:
Jon Evans 2020-07-06 12:16:55 -04:00
parent 98664ee714
commit 4e54b773e9
3 changed files with 16 additions and 3 deletions

View File

@ -204,6 +204,16 @@ static struct BOARD_CONNECTED_ITEM_DESC
{
BOARD_CONNECTED_ITEM_DESC()
{
auto& layerEnum = ENUM_MAP<PCB_LAYER_ID>::Instance();
if( layerEnum.Choices().GetCount() == 0 )
{
for( LSEQ seq = LSET::AllLayersMask().Seq(); seq; ++seq )
{
layerEnum.Map( *seq, LSET::Name( *seq ) );
}
}
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
REGISTER_TYPE( BOARD_CONNECTED_ITEM );
propMgr.InheritsAfter( TYPE_HASH( BOARD_CONNECTED_ITEM ), TYPE_HASH( BOARD_ITEM ) );

View File

@ -150,9 +150,12 @@ static struct BOARD_ITEM_DESC
{
auto& layerEnum = ENUM_MAP<PCB_LAYER_ID>::Instance();
for( LSEQ seq = LSET::AllLayersMask().Seq(); seq; ++seq )
if( layerEnum.Choices().GetCount() == 0 )
{
layerEnum.Map( *seq, LSET::Name( *seq ) );
for( LSEQ seq = LSET::AllLayersMask().Seq(); seq; ++seq )
{
layerEnum.Map( *seq, LSET::Name( *seq ) );
}
}
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();

View File

@ -1211,7 +1211,7 @@ static struct PAD_DESC
.Map( PAD_SHAPE_TRAPEZOID, _( "Trapezoid" ) )
.Map( PAD_SHAPE_ROUNDRECT, _( "Rounded Rectangle" ) )
.Map( PAD_SHAPE_CHAMFERED_RECT, _( "Chamfered Rectangle" ) )
.Map( PAD_SHAPE_CUSTOM, _( "Chamfered Rectangle" ) );
.Map( PAD_SHAPE_CUSTOM, _( "Custom" ) );
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
REGISTER_TYPE( D_PAD );