Pcbnew: fix crash when trying to delete a PCB_TEXT.

This commit is contained in:
jean-pierre charras 2023-04-02 12:15:18 +02:00
parent 31354a2d91
commit 054de5687c
1 changed files with 13 additions and 3 deletions

View File

@ -1798,15 +1798,25 @@ void EDIT_TOOL::DeleteItems( const PCB_SELECTION& aItems, bool aIsCut )
{ {
case PCB_TEXT::TEXT_is_VALUE: case PCB_TEXT::TEXT_is_VALUE:
case PCB_TEXT::TEXT_is_REFERENCE: case PCB_TEXT::TEXT_is_REFERENCE:
wxASSERT( parentFP );
m_commit->Modify( parentFP ); m_commit->Modify( parentFP );
static_cast<PCB_TEXT*>( board_item )->SetVisible( false ); static_cast<PCB_TEXT*>( board_item )->SetVisible( false );
getView()->Update( board_item ); getView()->Update( board_item );
break; break;
case PCB_TEXT::TEXT_is_DIVERS: case PCB_TEXT::TEXT_is_DIVERS:
if( IsFootprintEditor() )
{
m_commit->Modify( parentFP ); m_commit->Modify( parentFP );
getView()->Remove( board_item ); getView()->Remove( board_item );
parentFP->Remove( board_item ); parentFP->Remove( board_item );
}
else
{
m_commit->Remove( board_item );
}
break; break;
default: default:
wxFAIL; // Shouldn't get here wxFAIL; // Shouldn't get here
break; break;