Fix crash on OSX when page was changed before hack array was alloc'ed.

This commit is contained in:
Jeff Young 2020-04-10 16:01:11 +01:00
parent dac78d2562
commit 84944524cc
4 changed files with 12 additions and 12 deletions

View File

@ -87,6 +87,9 @@ PAGED_DIALOG::PAGED_DIALOG( wxWindow* aParent, const wxString& aTitle,
// Finish initialization after the bookctrl pages have been added.
void PAGED_DIALOG::finishInitialization()
{
for( size_t i = 0; i < m_treebook->GetPageCount(); ++i )
m_macHack.push_back( true );
// For some reason adding page labels to the treeCtrl doesn't invalidate its bestSize
// cache so we have to do it by hand
m_treebook->GetTreeCtrl()->InvalidateBestSize();
@ -100,9 +103,6 @@ void PAGED_DIALOG::finishInitialization()
m_treebook->Fit();
m_treebook->Layout();
for( size_t i = 0; i < m_treebook->GetPageCount(); ++i )
m_macHack.push_back( true );
FinishDialogSettings();
}

View File

@ -61,14 +61,14 @@ DIALOG_SCHEMATIC_SETUP::DIALOG_SCHEMATIC_SETUP( SCH_EDIT_FRAME* aFrame ) :
m_treebook->AddPage( new wxPanel( this ), _( "Project" ) );
m_treebook->AddSubPage( m_textVars, _( "Text Variables" ) );
for( size_t i = 0; i < m_treebook->GetPageCount(); ++i )
m_macHack.push_back( true );
// Connect Events
m_treebook->Connect( wxEVT_TREEBOOK_PAGE_CHANGED,
wxBookCtrlEventHandler( DIALOG_SCHEMATIC_SETUP::OnPageChange ), NULL, this );
FinishDialogSettings();
for( size_t i = 0; i < m_treebook->GetPageCount(); ++i )
m_macHack.push_back( true );
}

View File

@ -76,14 +76,14 @@ DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP( PCB_EDIT_FRAME* aFrame ) :
m_treebook->AddPage( new wxPanel( this ), _( "Project" ) );
m_treebook->AddSubPage( m_textVars, _( "Text Variables" ) );
for( size_t i = 0; i < m_treebook->GetPageCount(); ++i )
m_macHack.push_back( true );
// Connect Events
m_treebook->Connect( wxEVT_TREEBOOK_PAGE_CHANGED,
wxBookCtrlEventHandler( DIALOG_BOARD_SETUP::OnPageChange ), NULL, this );
FinishDialogSettings();
for( size_t i = 0; i < m_treebook->GetPageCount(); ++i )
m_macHack.push_back( true );
}

View File

@ -68,6 +68,9 @@ DIALOG_FOOTPRINT_BOARD_EDITOR::DIALOG_FOOTPRINT_BOARD_EDITOR( PCB_EDIT_FRAME* aP
m_frame = aParent;
m_footprint = aModule;
for( size_t i = 0; i < m_NoteBook->GetPageCount(); ++i )
m_macHack.push_back( true );
m_texts = new TEXT_MOD_GRID_TABLE( m_units, m_frame );
m_delayedErrorMessage = wxEmptyString;
@ -155,9 +158,6 @@ DIALOG_FOOTPRINT_BOARD_EDITOR::DIALOG_FOOTPRINT_BOARD_EDITOR( PCB_EDIT_FRAME* aP
m_buttonRemove->SetBitmap( KiBitmap( trash_xpm ) );
FinishDialogSettings();
for( size_t i = 0; i < m_NoteBook->GetPageCount(); ++i )
m_macHack.push_back( true );
}