Only warn once in KillFocus for each error value in footprint name.

More than that just gets annoying, and there is at least one edge case
which throws us into an infinite loop if we don't have something to
break us out.

Fixes: lp:1834966
* https://bugs.launchpad.net/kicad/+bug/1834966
This commit is contained in:
Jeff Young 2019-07-02 00:46:43 +01:00
parent faa730dfb1
commit 29db6152b3
1 changed files with 8 additions and 1 deletions

View File

@ -707,12 +707,19 @@ void DIALOG_FOOTPRINT_FP_EDITOR::OnFootprintNameText( wxCommandEvent& event )
void DIALOG_FOOTPRINT_FP_EDITOR::OnFootprintNameKillFocus( wxFocusEvent& event ) void DIALOG_FOOTPRINT_FP_EDITOR::OnFootprintNameKillFocus( wxFocusEvent& event )
{ {
if( !m_delayedFocusCtrl && !checkFootprintName( m_FootprintNameCtrl->GetValue() ) ) // Only warn once on KillFocus for each error value; after that it just gets annoying.
// This also fixes a bug where we endlessly cycle in some edge cases.
static wxString lastValue = wxEmptyString;
wxString valueNow = m_FootprintNameCtrl->GetValue();
if( !m_delayedFocusCtrl && valueNow != lastValue && !checkFootprintName( valueNow ) )
{ {
m_delayedFocusCtrl = m_FootprintNameCtrl; m_delayedFocusCtrl = m_FootprintNameCtrl;
m_delayedFocusPage = 0; m_delayedFocusPage = 0;
} }
lastValue = valueNow;
event.Skip(); event.Skip();
} }