Pcbnew: fix crash when trying to delete a DIMENSION living in a footprint

Fixes #15156
https://gitlab.com/kicad/code/kicad/-/issues/15156
This commit is contained in:
jean-pierre charras 2023-07-09 20:02:56 +02:00
parent 6182ff4834
commit bdaad32dc8
1 changed files with 8 additions and 1 deletions

View File

@ -1203,7 +1203,7 @@ int EDIT_TOOL::FilletLines( const TOOL_EVENT& aEvent )
return; return;
} }
PCB_SHAPE* tArc = new PCB_SHAPE( frame()->GetBoard(), SHAPE_T::ARC ); PCB_SHAPE* tArc = new PCB_SHAPE( frame()->GetModel(), SHAPE_T::ARC );
tArc->SetArcGeometry( sArc.GetP0(), sArc.GetArcMid(), sArc.GetP1() ); tArc->SetArcGeometry( sArc.GetP0(), sArc.GetArcMid(), sArc.GetP1() );
tArc->SetWidth( line_a->GetWidth() ); tArc->SetWidth( line_a->GetWidth() );
@ -1774,6 +1774,12 @@ void EDIT_TOOL::DeleteItems( const PCB_SELECTION& aItems, bool aIsCut )
case PCB_SHAPE_T: case PCB_SHAPE_T:
case PCB_TEXTBOX_T: case PCB_TEXTBOX_T:
case PCB_BITMAP_T: case PCB_BITMAP_T:
case PCB_DIMENSION_T:
case PCB_DIM_ALIGNED_T:
case PCB_DIM_LEADER_T:
case PCB_DIM_CENTER_T:
case PCB_DIM_RADIAL_T:
case PCB_DIM_ORTHOGONAL_T:
if( parentFP ) if( parentFP )
{ {
commit.Modify( parentFP ); commit.Modify( parentFP );
@ -1889,6 +1895,7 @@ void EDIT_TOOL::DeleteItems( const PCB_SELECTION& aItems, bool aIsCut )
} }
default: default:
wxASSERT_MSG( parentFP == nullptr, wxT( "Try to delete an item living in a footrprint" ) );
commit.Remove( board_item ); commit.Remove( board_item );
break; break;
} }