DIALOG_CONFIGURE_PATHS: delete path in list when a path is deleted in dialog.

Fixes #9531
https://gitlab.com/kicad/code/kicad/issues/9531
This commit is contained in:
jean-pierre charras 2021-11-09 10:35:49 +01:00
parent 59807d8d26
commit 39474921d9
1 changed files with 23 additions and 2 deletions

View File

@ -235,8 +235,7 @@ bool DIALOG_CONFIGURE_PATHS::TransferDataFromWindow()
if( !wxDialog::TransferDataFromWindow() )
return false;
// Environment variables
// Update environment variables
ENV_VAR_MAP& envVarMap = Pgm().GetLocalEnvVariables();
for( int row = 0; row < m_EnvVars->GetNumberRows(); ++row )
@ -272,6 +271,28 @@ bool DIALOG_CONFIGURE_PATHS::TransferDataFromWindow()
envVarMap[ name ] = ENV_VAR_ITEM( name, path );
}
// Remove deleted env vars
for( auto it = envVarMap.begin(); it != envVarMap.end(); )
{
bool found = false;
for( int row = 0; row < m_EnvVars->GetNumberRows(); ++row )
{
wxString name = m_EnvVars->GetCellValue( row, TV_NAME_COL );
if( it->first == name )
{
found = true;
break;
}
}
if( found )
++it;
else
it = envVarMap.erase( it );
}
Pgm().SetLocalEnvVariables();
// 3D search paths