Browse Source

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
6.0.7
Seth Hillbrand 4 years ago
parent
commit
f950d96324
  1. 3
      common/eda_base_frame.cpp
  2. 1
      common/pgm_base.cpp
  3. 2
      include/pgm_base.h
  4. 2
      kicad/kicad_manager_frame.cpp

3
common/eda_base_frame.cpp

@ -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 )

1
common/pgm_base.cpp

@ -108,6 +108,7 @@ PGM_BASE::PGM_BASE()
{
m_locale = nullptr;
m_Printing = false;
m_Quitting = false;
m_ModalDialogCount = 0;
setLanguageId( wxLANGUAGE_DEFAULT );

2
include/pgm_base.h

@ -292,6 +292,8 @@ public:
int m_ModalDialogCount;
bool m_Quitting;
protected:
/// Loads internal settings from COMMON_SETTINGS
void loadCommonSettings();

2
kicad/kicad_manager_frame.cpp

@ -435,6 +435,8 @@ bool KICAD_MANAGER_FRAME::CloseProject( bool aSave )
m_leftWin->EmptyTreePrj();
Pgm().m_Quitting = true;
return true;
}

Loading…
Cancel
Save