Prevent dereferencing frame on exit
Processing a menu event for quitting results in the frame being destroyed. This crashes the program when it tries to access the newly freed frame to check for autosave data. We bind the closing flag into the base program which will be the last item freed on exit to ensure we can correctly check for data loss Fixes https://gitlab.com/kicad/code/kicad/issues/8638
This commit is contained in:
parent
97943e0c7c
commit
f950d96324
|
@ -273,6 +273,9 @@ bool EDA_BASE_FRAME::ProcessEvent( wxEvent& aEvent )
|
|||
if( !wxFrame::ProcessEvent( aEvent ) )
|
||||
return false;
|
||||
|
||||
if( Pgm().m_Quitting )
|
||||
return true;
|
||||
|
||||
if( !m_isClosing && m_hasAutoSave && IsShown() && IsActive()
|
||||
&& m_autoSaveState != isAutoSaveRequired()
|
||||
&& m_autoSaveInterval > 0 )
|
||||
|
|
|
@ -108,6 +108,7 @@ PGM_BASE::PGM_BASE()
|
|||
{
|
||||
m_locale = nullptr;
|
||||
m_Printing = false;
|
||||
m_Quitting = false;
|
||||
m_ModalDialogCount = 0;
|
||||
|
||||
setLanguageId( wxLANGUAGE_DEFAULT );
|
||||
|
|
|
@ -292,6 +292,8 @@ public:
|
|||
|
||||
int m_ModalDialogCount;
|
||||
|
||||
bool m_Quitting;
|
||||
|
||||
protected:
|
||||
/// Loads internal settings from COMMON_SETTINGS
|
||||
void loadCommonSettings();
|
||||
|
|
|
@ -435,6 +435,8 @@ bool KICAD_MANAGER_FRAME::CloseProject( bool aSave )
|
|||
|
||||
m_leftWin->EmptyTreePrj();
|
||||
|
||||
Pgm().m_Quitting = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue