Fix project unloading in LoadProject

Fixes https://gitlab.com/kicad/code/kicad/-/issues/5380
This commit is contained in:
Jon Evans 2020-08-26 20:46:20 -04:00
parent 0dc0536cbf
commit cd54ba7b01
2 changed files with 9 additions and 2 deletions

View File

@ -697,8 +697,12 @@ bool SETTINGS_MANAGER::LoadProject( const wxString& aFullPath, bool aSetActive )
return true;
// No MDI yet
if( aSetActive && !m_projects.empty() && !UnloadProject( m_projects.begin()->second.get() ) )
return false;
if( aSetActive && !m_projects.empty() )
{
PROJECT* oldProject = m_projects.begin()->second.get();
unloadProjectFile( oldProject, true );
m_projects.erase( m_projects.begin() );
}
wxLogTrace( traceSettings, "Load project %s", fullPath );

View File

@ -1179,6 +1179,9 @@ void TREE_PROJECT_FRAME::FileWatcherReset()
#else
m_watcher->Add( fn );
if( m_TreeProject->IsEmpty() )
return;
// Add subdirs
wxTreeItemIdValue cookie;
wxTreeItemId root_id = m_root;