Fixed reference to PCB_EDIT_FRAME in PANEL_SETUP_LAYERS

GetParent() in PANEL_SETUP_LAYERS::TransferDataFromWindow() returns a
wxTreebook pointer, instead of expected PCB_EDIT_FRAME resulting in a
crash.
This commit is contained in:
Maciej Suminski 2018-09-04 12:28:52 +02:00
parent 009dfa411f
commit de65ca512f
2 changed files with 4 additions and 5 deletions

View File

@ -136,14 +136,13 @@ static const LSET presets[] =
PANEL_SETUP_LAYERS::PANEL_SETUP_LAYERS( PAGED_DIALOG* aParent, PCB_EDIT_FRAME* aFrame ) : PANEL_SETUP_LAYERS::PANEL_SETUP_LAYERS( PAGED_DIALOG* aParent, PCB_EDIT_FRAME* aFrame ) :
PANEL_SETUP_LAYERS_BASE( aParent->GetTreebook() ), PANEL_SETUP_LAYERS_BASE( aParent->GetTreebook() ),
m_Parent( aParent ), m_Parent( aParent ), m_frame( aFrame ),
m_pcbThickness( aFrame, m_thicknessLabel, m_thicknessCtrl, m_thicknessUnits, true, m_pcbThickness( aFrame, m_thicknessLabel, m_thicknessCtrl, m_thicknessUnits, true,
Millimeter2iu( 0.1 ), Millimeter2iu( 10.0 ) ) Millimeter2iu( 0.1 ), Millimeter2iu( 10.0 ) )
{ {
m_pcb = aFrame->GetBoard(); m_pcb = aFrame->GetBoard();
m_LayersListPanel->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_LISTBOX) ); m_LayersListPanel->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_LISTBOX) );
} }
@ -590,9 +589,8 @@ bool PANEL_SETUP_LAYERS::TransferDataFromWindow()
// because it is likely some tracks and vias where removed // because it is likely some tracks and vias where removed
if( hasRemovedBoardItems ) if( hasRemovedBoardItems )
{ {
PCB_EDIT_FRAME* editFrame = static_cast<PCB_EDIT_FRAME*>( GetParent() );
// Rebuild list of nets (full ratsnest rebuild) // Rebuild list of nets (full ratsnest rebuild)
editFrame->Compile_Ratsnest( NULL, true ); m_frame->Compile_Ratsnest( NULL, true );
m_pcb->BuildConnectivity(); m_pcb->BuildConnectivity();
} }

View File

@ -61,6 +61,7 @@ public:
private: private:
PAGED_DIALOG* m_Parent; PAGED_DIALOG* m_Parent;
PCB_EDIT_FRAME* m_frame;
BOARD* m_pcb; BOARD* m_pcb;
LSET m_enabledLayers; LSET m_enabledLayers;