Save the open projects into the settings before closing the project

Saving in the frame destructor is too late, because all projects
have been closed so the list being saved is empty.
This commit is contained in:
Ian McInerney 2020-08-08 23:40:50 +01:00
parent 226e5205c4
commit 30d42ca95a
1 changed files with 4 additions and 3 deletions

View File

@ -176,9 +176,6 @@ KICAD_MANAGER_FRAME::KICAD_MANAGER_FRAME( wxWindow* parent, const wxString& titl
KICAD_MANAGER_FRAME::~KICAD_MANAGER_FRAME() KICAD_MANAGER_FRAME::~KICAD_MANAGER_FRAME()
{ {
KICAD_SETTINGS* settings = kicadSettings();
settings->m_OpenProjects = GetSettingsManager()->GetOpenProjects();
// Shutdown all running tools // Shutdown all running tools
if( m_toolManager ) if( m_toolManager )
m_toolManager->ShutdownAllTools(); m_toolManager->ShutdownAllTools();
@ -328,6 +325,10 @@ void KICAD_MANAGER_FRAME::OnCloseWindow( wxCloseEvent& Event )
{ {
Event.SetCanVeto( true ); Event.SetCanVeto( true );
// Save the list of open projects before closing the project
KICAD_SETTINGS* settings = kicadSettings();
settings->m_OpenProjects = GetSettingsManager()->GetOpenProjects();
// Ensure the project is closed before destruction. // Ensure the project is closed before destruction.
CloseProject( true ); CloseProject( true );