Fix focus bug and possible race-condition for path deletion dialog

Fixes: lp:1788873
* https://bugs.launchpad.net/kicad/+bug/1788873
This commit is contained in:
Thomas Pointhuber 2018-08-30 14:21:01 +02:00 committed by Maciej Suminski
parent 202b35bc90
commit c170e8930b
1 changed files with 2 additions and 5 deletions

View File

@ -374,7 +374,7 @@ void DIALOG_CONFIGURE_PATHS::OnRemoveEnvVar( wxCommandEvent& event )
{
int curRow = m_EnvVars->GetGridCursorRow();
if( curRow < 0 )
if( curRow < 0 || m_EnvVars->GetNumberRows() <= curRow )
return;
else if( IsEnvVarImmutable( m_EnvVars->GetCellValue( curRow, EV_NAME_COL ) ) )
{
@ -394,11 +394,8 @@ void DIALOG_CONFIGURE_PATHS::OnDeleteSearchPath( wxCommandEvent& event )
{
int curRow = m_SearchPaths->GetGridCursorRow();
if( !m_SearchPaths->HasFocus() || curRow < 0 )
{
m_SearchPaths->SetFocus();
if( curRow < 0 || m_SearchPaths->GetNumberRows() <= curRow )
return;
}
m_SearchPaths->CommitPendingChanges( true /* silent mode; we don't care if it's valid */ );
m_SearchPaths->DeleteRows( curRow, 1 );