Make sure a project is loaded at all times

For now, much of KiCad depends on Prj() working, so when we
are asked to unload a project, immediately load the null project
so that nothing breaks.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/5374
This commit is contained in:
Jon Evans 2020-08-26 18:37:34 -04:00
parent 9ebdd4bd83
commit dc7e1783b3
3 changed files with 4 additions and 7 deletions

View File

@ -735,6 +735,10 @@ bool SETTINGS_MANAGER::UnloadProject( PROJECT* aProject, bool aSave )
m_projects.erase( aProject->GetProjectFullName() );
// Immediately reload a null project; this is required until the rest of the application
// is refactored to not assume that Prj() always works
LoadProject( "" );
// Remove the reference in the environment to the previous project
wxSetEnv( PROJECT_VAR_NAME, "" );

View File

@ -384,10 +384,6 @@ bool KICAD_MANAGER_FRAME::CloseProject( bool aSave )
m_active_project = false;
mgr.UnloadProject( &Prj() );
// TODO(JE): Remove this if apps are refactored to not assume Prj() always works
// Need to create a project early for now (it can have an empty path for the moment)
mgr.LoadProject( "" );
}
ClearMsg();

View File

@ -308,9 +308,6 @@ bool PCB_EDIT_FRAME::Files_io_from_id( int id )
onBoardLoaded();
// Don't set name until the user hits save, so project files are not created
mgr->LoadProject( "" );
LoadProjectSettings();
OnModify();