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:
parent
9ebdd4bd83
commit
dc7e1783b3
|
@ -735,6 +735,10 @@ bool SETTINGS_MANAGER::UnloadProject( PROJECT* aProject, bool aSave )
|
||||||
|
|
||||||
m_projects.erase( aProject->GetProjectFullName() );
|
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
|
// Remove the reference in the environment to the previous project
|
||||||
wxSetEnv( PROJECT_VAR_NAME, "" );
|
wxSetEnv( PROJECT_VAR_NAME, "" );
|
||||||
|
|
||||||
|
|
|
@ -384,10 +384,6 @@ bool KICAD_MANAGER_FRAME::CloseProject( bool aSave )
|
||||||
|
|
||||||
m_active_project = false;
|
m_active_project = false;
|
||||||
mgr.UnloadProject( &Prj() );
|
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();
|
ClearMsg();
|
||||||
|
|
|
@ -308,9 +308,6 @@ bool PCB_EDIT_FRAME::Files_io_from_id( int id )
|
||||||
|
|
||||||
onBoardLoaded();
|
onBoardLoaded();
|
||||||
|
|
||||||
// Don't set name until the user hits save, so project files are not created
|
|
||||||
mgr->LoadProject( "" );
|
|
||||||
|
|
||||||
LoadProjectSettings();
|
LoadProjectSettings();
|
||||||
|
|
||||||
OnModify();
|
OnModify();
|
||||||
|
|
Loading…
Reference in New Issue