FOOTPRINT_WIZARD_FRAME::ParametersUpdated(): fix a reentering issue
On wxWidgets 3.0.5, in some cases calling ReCreateParameterList() generates a EVT_GRID_CMD_CELL_CHANGED that call ParametersUpdated() and creating an infinite loop Note also it happens **only for languages using a comma** instead of a point for floating point separator It does not happen on wxWidgets 3.1.4 From master branch
This commit is contained in:
parent
1fdb247167
commit
54589c0828
|
@ -241,6 +241,9 @@ void FOOTPRINT_WIZARD_FRAME::DefaultParameters( wxCommandEvent& event )
|
||||||
DisplayWizardInfos();
|
DisplayWizardInfos();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This is a flag to avoid reentering of ParametersUpdated
|
||||||
|
// that can happen in some cases
|
||||||
|
static bool lock_update_prms = false;
|
||||||
|
|
||||||
void FOOTPRINT_WIZARD_FRAME::ParametersUpdated( wxGridEvent& event )
|
void FOOTPRINT_WIZARD_FRAME::ParametersUpdated( wxGridEvent& event )
|
||||||
{
|
{
|
||||||
|
@ -252,6 +255,9 @@ void FOOTPRINT_WIZARD_FRAME::ParametersUpdated( wxGridEvent& event )
|
||||||
if( m_parameterGridPage < 0 )
|
if( m_parameterGridPage < 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if( lock_update_prms )
|
||||||
|
return;
|
||||||
|
|
||||||
wxArrayString prmValues = footprintWizard->GetParameterValues( m_parameterGridPage );
|
wxArrayString prmValues = footprintWizard->GetParameterValues( m_parameterGridPage );
|
||||||
wxArrayString ptList = footprintWizard->GetParameterTypes( m_parameterGridPage );
|
wxArrayString ptList = footprintWizard->GetParameterTypes( m_parameterGridPage );
|
||||||
|
|
||||||
|
@ -271,7 +277,7 @@ void FOOTPRINT_WIZARD_FRAME::ParametersUpdated( wxGridEvent& event )
|
||||||
|
|
||||||
if( has_changed )
|
if( has_changed )
|
||||||
{
|
{
|
||||||
wxString res = footprintWizard->SetParameterValues( m_parameterGridPage, prmValues );
|
wxString res = footprintWizard->SetParameterValues( m_parameterGridPage, prmValues );
|
||||||
|
|
||||||
if( !res.IsEmpty() )
|
if( !res.IsEmpty() )
|
||||||
wxMessageBox( res );
|
wxMessageBox( res );
|
||||||
|
@ -281,8 +287,20 @@ void FOOTPRINT_WIZARD_FRAME::ParametersUpdated( wxGridEvent& event )
|
||||||
|
|
||||||
// The python script can have modified some other parameters.
|
// The python script can have modified some other parameters.
|
||||||
// So rebuild the current parameter list with new values, just in case.
|
// So rebuild the current parameter list with new values, just in case.
|
||||||
|
//
|
||||||
|
// On wxWidgets 3.0.5, ReCreateParameterList() generates a EVT_GRID_CMD_CELL_CHANGED
|
||||||
|
// that call ParametersUpdated() and creating an infinite loop
|
||||||
|
// Note also it happens **only for languages using a comma** instead of a point
|
||||||
|
// for floating point separator
|
||||||
|
// It does not happen on wxWidgets 3.1.4
|
||||||
|
//
|
||||||
|
// So lock the next call.
|
||||||
|
lock_update_prms = true;
|
||||||
ReCreateParameterList();
|
ReCreateParameterList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// unlock ParametersUpdated() now the update is finished
|
||||||
|
lock_update_prms = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue