diff --git a/cvpcb/cvpcb_mainframe.cpp b/cvpcb/cvpcb_mainframe.cpp index af735059b1..a5a9e8cd0a 100644 --- a/cvpcb/cvpcb_mainframe.cpp +++ b/cvpcb/cvpcb_mainframe.cpp @@ -125,6 +125,7 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) : m_libListBox = NULL; m_mainToolBar = NULL; m_modified = false; + m_cannotClose = false; m_skipComponentSelect = false; m_filteringOptions = 0; m_tcFilterString = NULL; @@ -307,6 +308,10 @@ void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event ) // clear highlight symbol in schematic: SendMessageToEESCHEMA( true ); + + if( m_cannotClose ) + return; + // Delete window Destroy(); } @@ -1117,7 +1122,11 @@ void CVPCB_MAINFRAME::KiwayMailIn( KIWAY_EXPRESS& mail ) switch( mail.Command() ) { case MAIL_EESCHEMA_NETLIST: + // Disable Close events during ReadNetListAndFpFiles() to avoid crash when updating + // widgets: + m_cannotClose = true; ReadNetListAndFpFiles( payload ); + m_cannotClose = false; /* @todo Go into SCH_EDIT_FRAME::OnOpenCvpcb( wxCommandEvent& event ) and trim GNL_ALL down. */ diff --git a/cvpcb/cvpcb_mainframe.h b/cvpcb/cvpcb_mainframe.h index 1cb86b28c6..04c46ce143 100644 --- a/cvpcb/cvpcb_mainframe.h +++ b/cvpcb/cvpcb_mainframe.h @@ -80,11 +80,13 @@ public: protected: bool m_modified; - bool m_skipComponentSelect; // true to skip OnSelectComponent event - // (in automatic selection/deletion of associations) + bool m_skipComponentSelect; // true to skip OnSelectComponent event + // (in automatic selection/deletion of associations) PARAM_CFG_ARRAY m_projectFileParams; bool m_initialized; + bool m_cannotClose; // true when the cvpcb frame cannot be closed + // (mainly during reading a netlist sent by Eeschema) CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent );