Defensive coding around getting an OnUpdateUI before we're ready.

This appears to happen at least on GTK when the 3DFileResolver throws
up error dialogs when paths can't be found.

Fixes https://gitlab.com/kicad/code/kicad/issues/9163
This commit is contained in:
Jeff Young 2021-09-14 13:28:45 +01:00
parent 0ae17f1e63
commit 4447843dc1
2 changed files with 8 additions and 1 deletions

View File

@ -67,7 +67,8 @@ DIALOG_FOOTPRINT_PROPERTIES::DIALOG_FOOTPRINT_PROPERTIES( PCB_EDIT_FRAME* aParen
m_SolderPasteMarginUnits ),
m_solderPasteRatio( aParent, m_PasteMarginRatioLabel, m_PasteMarginRatioCtrl,
m_PasteMarginRatioUnits ),
m_returnValue( FP_PROPS_CANCEL )
m_returnValue( FP_PROPS_CANCEL ),
m_initialized( false )
{
// Create the 3D models page
m_3dPanel = new PANEL_FP_PROPERTIES_3D_MODEL( m_frame, m_footprint, this, m_NoteBook );
@ -150,6 +151,7 @@ DIALOG_FOOTPRINT_PROPERTIES::DIALOG_FOOTPRINT_PROPERTIES( PCB_EDIT_FRAME* aParen
m_bpDelete->SetBitmap( KiBitmap( BITMAPS::small_trash ) );
finishDialogSettings();
m_initialized = true;
}
@ -617,6 +619,9 @@ void DIALOG_FOOTPRINT_PROPERTIES::adjustGridColumns( int aWidth )
void DIALOG_FOOTPRINT_PROPERTIES::OnUpdateUI( wxUpdateUIEvent& )
{
if( !m_initialized )
return;
if( !m_itemsGrid->IsCellEditControlShown() )
adjustGridColumns( m_itemsGrid->GetRect().GetWidth() );

View File

@ -113,6 +113,8 @@ private:
enum FP_PROPS_RETVALUE m_returnValue; // the option that closed the dialog
PANEL_FP_PROPERTIES_3D_MODEL* m_3dPanel;
bool m_initialized;
};