7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-18 19:39:17 +00:00

Fix a few more cases where migrated project files were being saved implicitly

This commit is contained in:
Jon Evans 2025-02-04 18:37:13 -05:00
parent c20cbc8857
commit a429afe4e9

View File

@ -156,6 +156,13 @@ void SETTINGS_MANAGER::Save()
if( dynamic_cast<COLOR_SETTINGS*>( settings.get() ) )
continue;
// Never automatically save project settings, caller should use SaveProject or UnloadProject
if( dynamic_cast<PROJECT_FILE*>( settings.get() )
|| dynamic_cast<PROJECT_LOCAL_SETTINGS*>( settings.get() ) )
{
continue;
}
settings->SaveToFile( GetPathForSettingsFile( settings.get() ) );
}
}
@ -1195,6 +1202,9 @@ bool SETTINGS_MANAGER::unloadProjectFile( PROJECT* aProject, bool aSave )
PROJECT_FILE* file = m_project_files[name];
if( file->WasMigrated() )
aSave = false;
auto it = std::find_if( m_settings.begin(), m_settings.end(),
[&file]( const std::unique_ptr<JSON_SETTINGS>& aPtr )
{
@ -1205,7 +1215,9 @@ bool SETTINGS_MANAGER::unloadProjectFile( PROJECT* aProject, bool aSave )
{
wxString projectPath = GetPathForSettingsFile( it->get() );
FlushAndRelease( &aProject->GetLocalSettings(), aSave );
bool saveLocalSettings = aSave && !aProject->GetLocalSettings().WasMigrated();
FlushAndRelease( &aProject->GetLocalSettings(), saveLocalSettings );
if( aSave )
( *it )->SaveToFile( projectPath );