Don't try to open files multiple times

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14703
This commit is contained in:
Jon Evans 2023-05-07 21:46:39 -04:00
parent 7978941fa8
commit 09e8f72196
2 changed files with 7 additions and 1 deletions

View File

@ -210,6 +210,8 @@ PROJECT_LOCAL_SETTINGS::PROJECT_LOCAL_SETTINGS( PROJECT* aProject, const wxStrin
return;
}
m_files.clear();
for( const nlohmann::json& file : aVal )
{
PROJECT_FILE_STATE fileState;

View File

@ -864,15 +864,19 @@ void KICAD_MANAGER_FRAME::OnIdle( wxIdleEvent& aEvent )
APP_PROGRESS_DIALOG progressReporter( _( "Restoring session" ), wxEmptyString,
previousOpenCount, this );
// We don't currently support opening more than one view per file
std::set<wxString> openedFiles;
int i = 0;
for( const PROJECT_FILE_STATE& file : Prj().GetLocalSettings().m_files )
{
if( file.open )
if( file.open && !openedFiles.count( file.fileName ) )
{
progressReporter.Update( i++,
wxString::Format( _( "Restoring '%s'" ), file.fileName ) );
openedFiles.insert( file.fileName );
wxFileName fn( file.fileName );
if( fn.GetExt() == LegacySchematicFileExtension