From 6573a43f3a3c89fba13b404d78b0e6face75d677 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Fri, 29 Sep 2017 09:49:09 -0700 Subject: [PATCH] pcbnew: multiple keepout zone bug fixes - Fixes segfault in ZONE_CONTAINER::SetLayerSet - Copies layerset when using assignment and new() --- pcbnew/class_zone.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pcbnew/class_zone.cpp b/pcbnew/class_zone.cpp index 410eb9fa00..6029d937e1 100644 --- a/pcbnew/class_zone.cpp +++ b/pcbnew/class_zone.cpp @@ -105,6 +105,7 @@ ZONE_CONTAINER::ZONE_CONTAINER( const ZONE_CONTAINER& aZone ) : m_hatchPitch = aZone.m_hatchPitch; m_HatchLines = aZone.m_HatchLines; + SetLayerSet( aZone.GetLayerSet() ); SetLocalFlags( aZone.GetLocalFlags() ); } @@ -133,6 +134,8 @@ ZONE_CONTAINER& ZONE_CONTAINER::operator=( const ZONE_CONTAINER& aOther ) m_FillSegmList.clear(); m_FillSegmList = aOther.m_FillSegmList; + SetLayerSet( aOther.GetLayerSet() ); + return *this; } @@ -213,17 +216,17 @@ void ZONE_CONTAINER::SetLayer( PCB_LAYER_ID aLayer ) void ZONE_CONTAINER::SetLayerSet( LSET aLayerSet ) { - if( aLayerSet.count() == 0 ) - { - return; - } - if( GetIsKeepout() ) { // Keepouts can only exist on copper layers aLayerSet &= LSET::AllCuMask(); } + if( aLayerSet.count() == 0 ) + { + return; + } + m_layerSet = aLayerSet; // Set the single layer to the first selected layer