From cabfcbc73cf081afd78595f517377bdaee53afe7 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Fri, 28 Jun 2019 19:23:00 -0700 Subject: [PATCH] pcbnew: Drop tracks not on copper We do not allow non-copper routed tracks and they will break assumptions elsewhere in the code. We drop them in the beginning so that they are not saved. --- pcbnew/class_board.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index 31588d847d..66d34face5 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -890,6 +890,14 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, ADD_MODE aMode ) case PCB_TRACE_T: case PCB_VIA_T: + + // N.B. This inserts a small memory leak as we lose the + if( !IsCopperLayer( aBoardItem->GetLayer() ) ) + { + wxFAIL_MSG( wxT( "BOARD::Add() Cannot place Track on non-copper layer" ) ); + return; + } + if( aMode == ADD_APPEND ) { m_Track.PushBack( (TRACK*) aBoardItem );