From 755607b8f80976fe3c12c228994f40817b2435af Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Mon, 13 Dec 2021 15:46:13 -0500 Subject: [PATCH] Fix a few wxUpdateUIEvent retrigger loops. --- common/widgets/paged_dialog.cpp | 4 +++- eeschema/dialogs/dialog_lib_symbol_properties.cpp | 2 +- pcbnew/dialogs/dialog_footprint_properties_fp_editor.cpp | 2 +- pcbnew/dialogs/dialog_pad_properties.cpp | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/common/widgets/paged_dialog.cpp b/common/widgets/paged_dialog.cpp index 7bfd029219..193cca216c 100644 --- a/common/widgets/paged_dialog.cpp +++ b/common/widgets/paged_dialog.cpp @@ -352,8 +352,10 @@ void PAGED_DIALOG::OnUpdateUI( wxUpdateUIEvent& event ) { unsigned next = m_treebook->GetSelection() + 1; + // Use ChangeSelection() here because SetSelection() generates page change events which + // creates an infinite wxUpdateUIEvent loop. if( next < m_treebook->GetPageCount() ) - m_treebook->SetSelection( next ); + m_treebook->ChangeSelection( next ); } } diff --git a/eeschema/dialogs/dialog_lib_symbol_properties.cpp b/eeschema/dialogs/dialog_lib_symbol_properties.cpp index d6b13cf278..a56a5c2d8d 100644 --- a/eeschema/dialogs/dialog_lib_symbol_properties.cpp +++ b/eeschema/dialogs/dialog_lib_symbol_properties.cpp @@ -750,7 +750,7 @@ void DIALOG_LIB_SYMBOL_PROPERTIES::OnUpdateUI( wxUpdateUIEvent& event ) if( m_delayedFocusPage >= 0 && m_NoteBook->GetSelection() != m_delayedFocusPage ) { - m_NoteBook->SetSelection( (unsigned) m_delayedFocusPage ); + m_NoteBook->ChangeSelection( (unsigned) m_delayedFocusPage ); m_delayedFocusPage = -1; } diff --git a/pcbnew/dialogs/dialog_footprint_properties_fp_editor.cpp b/pcbnew/dialogs/dialog_footprint_properties_fp_editor.cpp index aa1159a7b6..5a0dd4ff62 100644 --- a/pcbnew/dialogs/dialog_footprint_properties_fp_editor.cpp +++ b/pcbnew/dialogs/dialog_footprint_properties_fp_editor.cpp @@ -583,7 +583,7 @@ void DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::OnUpdateUI( wxUpdateUIEvent& event ) if( static_cast( m_delayedFocusPage ) >= 0 ) { if( m_NoteBook->GetSelection() != static_cast( m_delayedFocusPage ) ) - m_NoteBook->SetSelection( static_cast( m_delayedFocusPage ) ); + m_NoteBook->ChangeSelection( static_cast( m_delayedFocusPage ) ); m_delayedFocusPage = NOTEBOOK_PAGES::PAGE_UNKNOWN; } diff --git a/pcbnew/dialogs/dialog_pad_properties.cpp b/pcbnew/dialogs/dialog_pad_properties.cpp index 080be18c43..d1b750f7e1 100644 --- a/pcbnew/dialogs/dialog_pad_properties.cpp +++ b/pcbnew/dialogs/dialog_pad_properties.cpp @@ -1086,7 +1086,7 @@ void DIALOG_PAD_PROPERTIES::OnUpdateUI( wxUpdateUIEvent& event ) void DIALOG_PAD_PROPERTIES::OnUpdateUINonCopperWarning( wxUpdateUIEvent& event ) { bool isOnCopperLayer = ( m_dummyPad->GetLayerSet() & LSET::AllCuMask() ).any(); - m_nonCopperWarningBook->SetSelection( isOnCopperLayer ? 0 : 1 ); + m_nonCopperWarningBook->ChangeSelection( isOnCopperLayer ? 0 : 1 ); }