pcbnew: multiple keepout zone bug fixes

- Fixes segfault in ZONE_CONTAINER::SetLayerSet
- Copies layerset when using assignment and new()
This commit is contained in:
Seth Hillbrand 2017-09-29 09:49:09 -07:00 committed by jean-pierre charras
parent d00fc993f3
commit 6573a43f3a
1 changed files with 8 additions and 5 deletions

View File

@ -105,6 +105,7 @@ ZONE_CONTAINER::ZONE_CONTAINER( const ZONE_CONTAINER& aZone ) :
m_hatchPitch = aZone.m_hatchPitch; m_hatchPitch = aZone.m_hatchPitch;
m_HatchLines = aZone.m_HatchLines; m_HatchLines = aZone.m_HatchLines;
SetLayerSet( aZone.GetLayerSet() );
SetLocalFlags( aZone.GetLocalFlags() ); SetLocalFlags( aZone.GetLocalFlags() );
} }
@ -133,6 +134,8 @@ ZONE_CONTAINER& ZONE_CONTAINER::operator=( const ZONE_CONTAINER& aOther )
m_FillSegmList.clear(); m_FillSegmList.clear();
m_FillSegmList = aOther.m_FillSegmList; m_FillSegmList = aOther.m_FillSegmList;
SetLayerSet( aOther.GetLayerSet() );
return *this; return *this;
} }
@ -213,17 +216,17 @@ void ZONE_CONTAINER::SetLayer( PCB_LAYER_ID aLayer )
void ZONE_CONTAINER::SetLayerSet( LSET aLayerSet ) void ZONE_CONTAINER::SetLayerSet( LSET aLayerSet )
{ {
if( aLayerSet.count() == 0 )
{
return;
}
if( GetIsKeepout() ) if( GetIsKeepout() )
{ {
// Keepouts can only exist on copper layers // Keepouts can only exist on copper layers
aLayerSet &= LSET::AllCuMask(); aLayerSet &= LSET::AllCuMask();
} }
if( aLayerSet.count() == 0 )
{
return;
}
m_layerSet = aLayerSet; m_layerSet = aLayerSet;
// Set the single layer to the first selected layer // Set the single layer to the first selected layer