Immediate fix to prevent crashing, don't call ClosePlayers twice

Fixes https://gitlab.com/kicad/code/kicad/-/issues/5164
This commit is contained in:
Marek Roszko 2020-08-12 18:17:51 -04:00
parent e05cd0e914
commit c36080a250
1 changed files with 8 additions and 11 deletions

View File

@ -303,7 +303,7 @@ void KICAD_MANAGER_FRAME::OnSize( wxSizeEvent& event )
}
void KICAD_MANAGER_FRAME::OnCloseWindow( wxCloseEvent& Event )
void KICAD_MANAGER_FRAME::OnCloseWindow( wxCloseEvent& aEvent )
{
#ifdef _WINDOWS_
// For some obscure reason, on Windows, when killing Kicad from the Windows task manager
@ -321,17 +321,14 @@ void KICAD_MANAGER_FRAME::OnCloseWindow( wxCloseEvent& Event )
}
#endif
if( Kiway().PlayersClose( false ) )
// Save the list of open projects before closing the project
KICAD_SETTINGS* settings = kicadSettings();
settings->m_OpenProjects = GetSettingsManager()->GetOpenProjects();
aEvent.SetCanVeto( true );
if( CloseProject( 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.
CloseProject( true );
m_leftWin->Show( false );
Destroy();