From 054de5687cde82adf52135d5df3c065081ffc222 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sun, 2 Apr 2023 12:15:18 +0200 Subject: [PATCH] Pcbnew: fix crash when trying to delete a PCB_TEXT. --- pcbnew/tools/edit_tool.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index f3ef8c3c85..bee05c01f9 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -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_REFERENCE: + wxASSERT( parentFP ); m_commit->Modify( parentFP ); static_cast( board_item )->SetVisible( false ); getView()->Update( board_item ); break; + case PCB_TEXT::TEXT_is_DIVERS: - m_commit->Modify( parentFP ); - getView()->Remove( board_item ); - parentFP->Remove( board_item ); + if( IsFootprintEditor() ) + { + m_commit->Modify( parentFP ); + getView()->Remove( board_item ); + parentFP->Remove( board_item ); + } + else + { + m_commit->Remove( board_item ); + } break; + default: wxFAIL; // Shouldn't get here break;