FOOTPRINT_WIZARD_FRAME: fix a crash when opening the frame.

LoadSettings() was using the gal canvas, but the gal canvas was not created
when calling LoadSettings().
This commit is contained in:
jean-pierre charras 2020-09-01 09:32:05 +02:00
parent 30b402bc02
commit 756d6a123b
2 changed files with 19 additions and 13 deletions

View File

@ -4,7 +4,7 @@
* Copyright (C) 2012-2015 Miguel Angel Ajo Pelayo <miguelangel@nbee.es>
* Copyright (C) 2012-2019 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008-2015 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2019 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2004-2020 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -105,6 +105,14 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway, wxWindow* aParent
SetScreen( new PCB_SCREEN( GetPageSizeIU() ) );
GetScreen()->m_Center = true; // Center coordinate origins on screen.
// Create the GAL canvas.
// Must be created before calling LoadSettings() that needs a valid GAL canvas
PCB_DRAW_PANEL_GAL* gal_drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ),
m_FrameSize,
GetGalDisplayOptions(),
EDA_DRAW_PANEL_GAL::GAL_FALLBACK );
SetCanvas( gal_drawPanel );
LoadSettings( config() );
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
@ -125,13 +133,6 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway, wxWindow* aParent
GetBoard()->GetDesignSettings().GetDefault()->SetClearance( 0 );
GetBoard()->SetElementVisibility( LAYER_NO_CONNECTS, false );
// Create GAL canvas
PCB_DRAW_PANEL_GAL* gal_drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ),
m_FrameSize,
GetGalDisplayOptions(),
EDA_DRAW_PANEL_GAL::GAL_FALLBACK );
SetCanvas( gal_drawPanel );
PCB_DISPLAY_OPTIONS disp_opts = GetDisplayOptions();
disp_opts.m_DisplayPadIsol = true;

View File

@ -703,6 +703,10 @@ void PCB_BASE_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
m_PolarCoords = cfg->m_PolarCoords;
}
wxASSERT( GetCanvas() );
if( GetCanvas() )
{
RENDER_SETTINGS* rs = GetCanvas()->GetView()->GetPainter()->GetSettings();
if( rs )
@ -711,6 +715,7 @@ void PCB_BASE_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
rs->SetSelectFactor( aCfg->m_Graphics.select_factor );
rs->SetHighContrastFactor( aCfg->m_Graphics.high_contrast_factor );
}
}
}