Fix crash on cut/remove a part in symbol library editor
Fixes: lp:1738635 * https://bugs.launchpad.net/kicad/+bug/1738635 Fixes: lp:1738999 * https://bugs.launchpad.net/kicad/+bug/1738999
This commit is contained in:
parent
7741b90c78
commit
f3a6bc6651
|
@ -374,6 +374,10 @@ void LIB_EDIT_FRAME::OnRemovePart( wxCommandEvent& aEvent )
|
|||
if( isCurrentPart( libId ) )
|
||||
emptyScreen();
|
||||
|
||||
// Keeping a removed item selected may lead to a crash
|
||||
if( m_treePane->GetCmpTree()->GetSelectedLibId( nullptr ) == libId )
|
||||
m_treePane->GetCmpTree()->SelectLibId( LIB_ID( libId.GetLibNickname(), "" ) );
|
||||
|
||||
m_libMgr->RemovePart( libId.GetLibItemName(), libId.GetLibNickname() );
|
||||
}
|
||||
|
||||
|
@ -395,6 +399,10 @@ void LIB_EDIT_FRAME::OnCopyCutPart( wxCommandEvent& aEvent )
|
|||
if( isCurrentPart( libId ) )
|
||||
emptyScreen();
|
||||
|
||||
// Keeping a removed item selected may lead to a crash
|
||||
if( m_treePane->GetCmpTree()->GetSelectedLibId( nullptr ) == libId )
|
||||
m_treePane->GetCmpTree()->SelectLibId( LIB_ID( libId.GetLibNickname(), "" ) );
|
||||
|
||||
m_libMgr->RemovePart( libId.GetLibItemName(), libId.GetLibNickname() );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue