From 26ebf3c96120f64c3665e4475a3eb539da3f9e9c Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 15 Oct 2019 13:41:49 +0200 Subject: [PATCH] Fix ZONE_CONTAINER ctor issue: incorrect net info setting. In ZONE_CONTAINER( ZONE_CONTAINER& aOther ), the net info was set before zone type and layer were set. So the net info was always set to ORPHAN net, instead of set to aOther net info. Especially, it broke undo/redo function. Fixes: lp:1840727 https://bugs.launchpad.net/kicad/+bug/1840727 --- pcbnew/class_zone.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pcbnew/class_zone.cpp b/pcbnew/class_zone.cpp index ee91511438..253e1cc3ed 100644 --- a/pcbnew/class_zone.cpp +++ b/pcbnew/class_zone.cpp @@ -76,8 +76,6 @@ ZONE_CONTAINER::ZONE_CONTAINER( BOARD* aBoard ) : ZONE_CONTAINER::ZONE_CONTAINER( const ZONE_CONTAINER& aZone ) : BOARD_CONNECTED_ITEM( aZone ) { - // Should the copy be on the same net? - SetNetCode( aZone.GetNetCode() ); m_Poly = new SHAPE_POLY_SET( *aZone.m_Poly ); // For corner moving, corner index to drag, or nullptr if no selection @@ -116,6 +114,10 @@ ZONE_CONTAINER::ZONE_CONTAINER( const ZONE_CONTAINER& aZone ) : SetLayerSet( aZone.GetLayerSet() ); SetLocalFlags( aZone.GetLocalFlags() ); + // Now zone type and layer are set, transfer net info + // (has meaning only for copper zones) + SetNetCode( aZone.GetNetCode() ); + SetNeedRefill( aZone.NeedRefill() ); }