Reentrancy block for symbol editor symbol properties dialog.

Fixes https://gitlab.com/kicad/code/kicad/issues/11060

(cherry picked from commit d3716b9956)
This commit is contained in:
Jeff Young 2022-03-07 10:25:28 +00:00
parent da480aba47
commit fd5eeceb4f
1 changed files with 7 additions and 1 deletions

View File

@ -455,10 +455,16 @@ void DIALOG_LIB_SYMBOL_PROPERTIES::OnSymbolNameText( wxCommandEvent& event )
void DIALOG_LIB_SYMBOL_PROPERTIES::OnSymbolNameKillFocus( wxFocusEvent& event )
{
if( !m_delayedFocusCtrl && !m_SymbolNameCtrl->GetValidator()->Validate( m_SymbolNameCtrl ) )
if( !m_delayedFocusCtrl )
{
// If the validation fails and we throw up a dialog then GTK will give us another
// KillFocus event and we end up in infinite recursion. So we use m_delayedFocusCtrl
// as a re-entrancy block and then clear it again if validation passes.
m_delayedFocusCtrl = m_SymbolNameCtrl;
m_delayedFocusPage = 0;
if( m_SymbolNameCtrl->GetValidator()->Validate( m_SymbolNameCtrl ) )
m_delayedFocusCtrl = nullptr;
}
event.Skip();