Cancel placement of via if user cancels layer selection.

Fixes https://gitlab.com/kicad/code/kicad/issues/7578
This commit is contained in:
Jeff Young 2021-02-18 11:50:37 +00:00
parent 59b81462ab
commit 45b2bce698
2 changed files with 8 additions and 6 deletions

View File

@ -761,6 +761,9 @@ int ROUTER_TOOL::handleLayerSwitch( const TOOL_EVENT& aEvent, bool aForceVia )
}
}
if( targetLayer == UNDEFINED_LAYER )
return 0;
// fixme: P&S supports more than one fixed layer pair. Update the dialog?
sizes.ClearLayerPairs();

View File

@ -222,8 +222,7 @@ void PCB_ONE_LAYER_SELECTOR::OnRightGridCellClick( wxGridEvent& event )
}
PCB_LAYER_ID PCB_BASE_FRAME::SelectOneLayer( PCB_LAYER_ID aDefaultLayer,
LSET aNotAllowedLayersMask,
PCB_LAYER_ID PCB_BASE_FRAME::SelectOneLayer( PCB_LAYER_ID aDefaultLayer, LSET aNotAllowedLayersMask,
wxPoint aDlgPosition )
{
PCB_ONE_LAYER_SELECTOR dlg( this, GetBoard(), aDefaultLayer, aNotAllowedLayersMask );
@ -236,10 +235,10 @@ PCB_LAYER_ID PCB_BASE_FRAME::SelectOneLayer( PCB_LAYER_ID aDefaultLayer,
dlg.SetPosition( aDlgPosition );
}
dlg.ShowModal();
PCB_LAYER_ID layer = ToLAYER_ID( dlg.GetLayerSelection() );
return layer;
if( dlg.ShowModal() != wxID_CANCEL )
return ToLAYER_ID( dlg.GetLayerSelection() );
else
return UNDEFINED_LAYER;
}