Fix initilization project / ordering
We cannot resolve the Canvas type without the canvas being initialized. But saving settings sometimes requests canvas access. This protects the calls against failure by checking for canvas before saving canvas-specific settings Fixes https://gitlab.com/kicad/code/kicad/issues/9729
This commit is contained in:
parent
5060c73625
commit
126563c839
|
@ -264,8 +264,11 @@ void SCH_BASE_FRAME::CenterScreen( const wxPoint& aCenterPoint, bool aWarpPointe
|
|||
|
||||
void SCH_BASE_FRAME::HardRedraw()
|
||||
{
|
||||
GetCanvas()->GetView()->UpdateAllItems( KIGFX::ALL );
|
||||
GetCanvas()->ForceRefresh();
|
||||
if( GetCanvas() && GetCanvas()->GetView() )
|
||||
{
|
||||
GetCanvas()->GetView()->UpdateAllItems( KIGFX::ALL );
|
||||
GetCanvas()->ForceRefresh();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -277,8 +280,13 @@ SCH_DRAW_PANEL* SCH_BASE_FRAME::GetCanvas() const
|
|||
|
||||
KIGFX::SCH_RENDER_SETTINGS* SCH_BASE_FRAME::GetRenderSettings()
|
||||
{
|
||||
KIGFX::PAINTER* painter = GetCanvas()->GetView()->GetPainter();
|
||||
return static_cast<KIGFX::SCH_RENDER_SETTINGS*>( painter->GetSettings() );
|
||||
if( GetCanvas() && GetCanvas()->GetView() )
|
||||
{
|
||||
if( KIGFX::PAINTER* painter = GetCanvas()->GetView()->GetPainter() )
|
||||
return static_cast<KIGFX::SCH_RENDER_SETTINGS*>( painter->GetSettings() );
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -722,7 +722,9 @@ void SYMBOL_VIEWER_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg)
|
|||
|
||||
cfg->m_LibViewPanel.lib_list_width = m_libListWidth;
|
||||
cfg->m_LibViewPanel.cmp_list_width = m_symbolListWidth;
|
||||
cfg->m_LibViewPanel.show_pin_electrical_type = GetRenderSettings()->m_ShowPinsElectricalType;
|
||||
|
||||
if( GetRenderSettings() )
|
||||
cfg->m_LibViewPanel.show_pin_electrical_type = GetRenderSettings()->m_ShowPinsElectricalType;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -178,14 +178,14 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
|
|||
fpPanel->Fit();
|
||||
|
||||
// Create GAL canvas
|
||||
resolveCanvasType();
|
||||
m_canvasType = loadCanvasTypeSetting();
|
||||
SwitchCanvas( m_canvasType );
|
||||
|
||||
PCB_DRAW_PANEL_GAL* drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_frameSize,
|
||||
GetGalDisplayOptions(), m_canvasType );
|
||||
SetCanvas( drawPanel );
|
||||
|
||||
resolveCanvasType();
|
||||
|
||||
SetBoard( new BOARD() );
|
||||
|
||||
// This board will only be used to hold a footprint for viewing
|
||||
|
@ -794,7 +794,8 @@ void FOOTPRINT_VIEWER_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
|
|||
// We don't want to store anything other than the window settings
|
||||
PCB_BASE_FRAME::SaveSettings( cfg );
|
||||
|
||||
cfg->m_FootprintViewerZoom = GetCanvas()->GetView()->GetScale();
|
||||
if( GetCanvas() && GetCanvas()->GetView() )
|
||||
cfg->m_FootprintViewerZoom = GetCanvas()->GetView()->GetScale();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -990,7 +990,8 @@ void PCB_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
|
|||
cfg->m_ShowPageLimits = m_showPageLimits;
|
||||
}
|
||||
|
||||
GetSettingsManager()->SaveColorSettings( GetColorSettings(), "board" );
|
||||
if( GetSettingsManager() )
|
||||
GetSettingsManager()->SaveColorSettings( GetColorSettings(), "board" );
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue