From e90452d0e21e0d2618ff7b5fea34b2f352be2c60 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Wed, 10 Apr 2019 18:11:30 +0100 Subject: [PATCH] When checking for duplicate aliases look in the dialog not the symbol. Fixes: lp:1821543 * https://bugs.launchpad.net/kicad/+bug/1821543 --- eeschema/dialogs/dialog_edit_component_in_lib.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/eeschema/dialogs/dialog_edit_component_in_lib.cpp b/eeschema/dialogs/dialog_edit_component_in_lib.cpp index b0af9a3e5c..e9a79d49fe 100644 --- a/eeschema/dialogs/dialog_edit_component_in_lib.cpp +++ b/eeschema/dialogs/dialog_edit_component_in_lib.cpp @@ -657,6 +657,14 @@ bool DIALOG_EDIT_COMPONENT_IN_LIBRARY::checkAliasName( const wxString& aName ) if( aName.IsEmpty() ) return false; + if( m_SymbolNameCtrl->GetValue().CmpNoCase( aName ) == 0 ) + { + wxString msg; + msg.Printf( _( "Alias can not have same name as symbol." ) ); + DisplayInfoMessage( this, msg ); + return false; + } + for( int i = 0; i < (int)m_aliasListBox->GetCount(); ++i ) { if( i == m_aliasListBox->GetSelection() ) @@ -700,7 +708,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnAddAlias( wxCommandEvent& event ) wxString aliasname = _( "untitled" ); int suffix = 1; - while( m_libEntry->HasAlias( aliasname ) ) + while( m_aliasListBox->FindString( aliasname ) != wxNOT_FOUND ) aliasname = wxString::Format( _( "untitled%i" ), suffix++ ); LIB_ALIAS* alias = new LIB_ALIAS( aliasname, m_libEntry );