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_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.
*/

View File

@ -85,6 +85,8 @@ protected:
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 );