Cvpcb: fix possible crash when pressing the ESC key during some calculations.

From master branch, commit b1c67d9
This commit is contained in:
jean-pierre charras 2021-08-06 20:22:03 +02:00
parent 2975e85950
commit 73193196d2
2 changed files with 13 additions and 2 deletions

View File

@ -125,6 +125,7 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_libListBox = NULL; m_libListBox = NULL;
m_mainToolBar = NULL; m_mainToolBar = NULL;
m_modified = false; m_modified = false;
m_cannotClose = false;
m_skipComponentSelect = false; m_skipComponentSelect = false;
m_filteringOptions = 0; m_filteringOptions = 0;
m_tcFilterString = NULL; m_tcFilterString = NULL;
@ -307,6 +308,10 @@ void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event )
// clear highlight symbol in schematic: // clear highlight symbol in schematic:
SendMessageToEESCHEMA( true ); SendMessageToEESCHEMA( true );
if( m_cannotClose )
return;
// Delete window // Delete window
Destroy(); Destroy();
} }
@ -1117,7 +1122,11 @@ void CVPCB_MAINFRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
switch( mail.Command() ) switch( mail.Command() )
{ {
case MAIL_EESCHEMA_NETLIST: case MAIL_EESCHEMA_NETLIST:
// Disable Close events during ReadNetListAndFpFiles() to avoid crash when updating
// widgets:
m_cannotClose = true;
ReadNetListAndFpFiles( payload ); ReadNetListAndFpFiles( payload );
m_cannotClose = false;
/* @todo /* @todo
Go into SCH_EDIT_FRAME::OnOpenCvpcb( wxCommandEvent& event ) and trim GNL_ALL down. Go into SCH_EDIT_FRAME::OnOpenCvpcb( wxCommandEvent& event ) and trim GNL_ALL down.
*/ */

View File

@ -80,11 +80,13 @@ public:
protected: protected:
bool m_modified; bool m_modified;
bool m_skipComponentSelect; // true to skip OnSelectComponent event bool m_skipComponentSelect; // true to skip OnSelectComponent event
// (in automatic selection/deletion of associations) // (in automatic selection/deletion of associations)
PARAM_CFG_ARRAY m_projectFileParams; PARAM_CFG_ARRAY m_projectFileParams;
bool m_initialized; 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 ); CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent );