Prevent event stackup when init pages

The paged book initialization (and others) can generate events,
re-laying out the whole dialog multiple times during initialization.
This halts events during the layout period

Fixes https://gitlab.com/kicad/code/kicad/issues/13158
This commit is contained in:
Seth Hillbrand 2022-12-15 11:35:35 -08:00
parent a41f27a022
commit e91c039ed3
4 changed files with 11 additions and 0 deletions

View File

@ -55,6 +55,7 @@ DIALOG_ABOUT::DIALOG_ABOUT( EDA_BASE_FRAME *aParent, ABOUT_APP_INFO& aAppInfo )
{
wxASSERT( aParent != nullptr );
SetEvtHandlerEnabled( false );
// TODO: Change these to 16x16 versions when available
m_images = new wxImageList( 24, 24, false, 9 );
@ -96,6 +97,7 @@ DIALOG_ABOUT::DIALOG_ABOUT( EDA_BASE_FRAME *aParent, ABOUT_APP_INFO& aAppInfo )
SetTitle( wxString::Format( _( "About %s" ), m_titleName ) );
createNotebooks();
SetEvtHandlerEnabled( true );
GetSizer()->SetSizeHints( this );
SetFocus();
Centre();

View File

@ -991,6 +991,8 @@ void EDA_BASE_FRAME::ShowPreferences( wxString aStartPage, wxString aStartParent
wxBeginBusyCursor( wxHOURGLASS_CURSOR );
PAGED_DIALOG dlg( this, _( "Preferences" ), true );
dlg.SetEvtHandlerEnabled( false );
wxTreebook* book = dlg.GetTreebook();
PANEL_HOTKEYS_EDITOR* hotkeysPanel = new PANEL_HOTKEYS_EDITOR( this, book, false );
@ -1127,6 +1129,7 @@ void EDA_BASE_FRAME::ShowPreferences( wxString aStartPage, wxString aStartParent
if( !aStartPage.IsEmpty() )
dlg.SetInitialPage( aStartPage, aStartParentPage );
dlg.SetEvtHandlerEnabled( true );
wxEndBusyCursor();
if( dlg.ShowModal() == wxID_OK )

View File

@ -47,6 +47,8 @@ DIALOG_SCHEMATIC_SETUP::DIALOG_SCHEMATIC_SETUP( SCH_EDIT_FRAME* aFrame ) :
SCHEMATIC& schematic = aFrame->Schematic();
SCHEMATIC_SETTINGS& settings = schematic.Settings();
SetEvtHandlerEnabled( false );
m_formatting = new PANEL_SETUP_FORMATTING( m_treebook, aFrame );
m_fieldNameTemplates = new PANEL_TEMPLATE_FIELDNAMES( m_treebook,
@ -86,6 +88,8 @@ DIALOG_SCHEMATIC_SETUP::DIALOG_SCHEMATIC_SETUP( SCH_EDIT_FRAME* aFrame ) :
for( size_t i = 0; i < m_treebook->GetPageCount(); ++i )
m_treebook->ExpandNode( i );
SetEvtHandlerEnabled( true );
finishDialogSettings();
if( Prj().IsReadOnly() )

View File

@ -53,6 +53,7 @@ DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP( PCB_EDIT_FRAME* aFrame ) :
_( "Import Settings from Another Board..." ) ),
m_frame( aFrame )
{
SetEvtHandlerEnabled( false );
PROJECT_FILE& project = aFrame->Prj().GetProjectFile();
BOARD* board = aFrame->GetBoard();
BOARD_DESIGN_SETTINGS& bds = board->GetDesignSettings();
@ -116,6 +117,7 @@ DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP( PCB_EDIT_FRAME* aFrame ) :
m_treebook->ExpandNode( i );
m_treebook->SetMinSize( wxSize( -1, 580 ) );
SetEvtHandlerEnabled( true );
finishDialogSettings();