From 80846dcbc73d04332127bfce35c594b9a17f583f Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 21 Aug 2020 19:12:51 +0100 Subject: [PATCH] Improve shutdown performance. --- common/eda_base_frame.cpp | 5 +++-- eeschema/sch_edit_frame.cpp | 1 + include/eda_base_frame.h | 2 ++ pcbnew/pcb_edit_frame.cpp | 2 ++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/common/eda_base_frame.cpp b/common/eda_base_frame.cpp index be9b5185ff..53b27af089 100644 --- a/common/eda_base_frame.cpp +++ b/common/eda_base_frame.cpp @@ -84,7 +84,8 @@ EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* aParent, FRAME_T aFrameType, m_autoSaveState( false ), m_autoSaveInterval(-1 ), m_UndoRedoCountMax( DEFAULT_MAX_UNDO_ITEMS ), - m_userUnits( EDA_UNITS::MILLIMETRES ) + m_userUnits( EDA_UNITS::MILLIMETRES ), + m_shuttingDown( false ) { m_autoSaveTimer = new wxTimer( this, ID_AUTO_SAVE_TIMER ); m_mruPath = wxStandardPaths::Get().GetDocumentsDir(); @@ -656,7 +657,7 @@ void EDA_BASE_FRAME::UpdateFileHistory( const wxString& FullFileName, FILE_HISTO aFileHistory->AddFileToHistory( FullFileName ); // Update the menubar to update the file history menu - if( GetMenuBar() ) + if( !m_shuttingDown && GetMenuBar() ) { ReCreateMenuBar(); GetMenuBar()->Refresh(); diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index 61ae0a6f37..891220de44 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -629,6 +629,7 @@ void SCH_EDIT_FRAME::OnCloseWindow( wxCloseEvent& aEvent ) // // OK, we're really closing now. No more returns after this. // + m_shuttingDown = true; // Shutdown all running tools ( and commit any pending change ) if( m_toolManager ) diff --git a/include/eda_base_frame.h b/include/eda_base_frame.h index 7e35ec093c..39acb537ae 100644 --- a/include/eda_base_frame.h +++ b/include/eda_base_frame.h @@ -163,6 +163,8 @@ protected: EDA_UNITS m_userUnits; + bool m_shuttingDown; + // Map containing the UI update handlers registered with wx for each action std::map m_uiUpdateMap; diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index 8e5147574a..df270f0f1a 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -813,6 +813,8 @@ void PCB_EDIT_FRAME::OnCloseWindow( wxCloseEvent& aEvent ) } } + m_shuttingDown = true; + // On Windows 7 / 32 bits, on OpenGL mode only, Pcbnew crashes // when closing this frame if a footprint was selected, and the footprint editor called // to edit this footprint, and when closing pcbnew if this footprint is still selected