Fixed a crash in pcbnew (GAL).

This commit is contained in:
Maciej Suminski 2016-05-02 16:15:26 +02:00
parent 09d2d5367a
commit 2f874097ae
2 changed files with 4 additions and 5 deletions

View File

@ -52,6 +52,7 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin
wxScrolledCanvas( aParentWindow, aWindowId, aPosition, aSize )
{
m_parent = aParentWindow;
m_edaFrame = dynamic_cast<EDA_DRAW_FRAME*>( aParentWindow );
m_gal = NULL;
m_backend = GAL_TYPE_NONE;
m_view = NULL;
@ -105,8 +106,6 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin
m_drawingEnabled = false;
Connect( wxEVT_TIMER, wxTimerEventHandler( EDA_DRAW_PANEL_GAL::onRefreshTimer ), NULL, this );
m_edaFrame = dynamic_cast<EDA_DRAW_FRAME*>( aParentWindow );
LoadGalSettings();
}
@ -373,7 +372,7 @@ bool EDA_DRAW_PANEL_GAL::SwitchBackend( GAL_TYPE aGalType )
bool EDA_DRAW_PANEL_GAL::SaveGalSettings()
{
if( !m_edaFrame )
if( !m_edaFrame || !m_gal )
return false;
wxConfigBase* cfg = Kiface().KifaceSettings();
@ -391,7 +390,7 @@ bool EDA_DRAW_PANEL_GAL::SaveGalSettings()
bool EDA_DRAW_PANEL_GAL::LoadGalSettings()
{
if( !m_edaFrame )
if( !m_edaFrame || !m_gal )
return false;
wxConfigBase* cfg = Kiface().KifaceSettings();

View File

@ -109,7 +109,7 @@ EDA_DRAW_PANEL_GAL( aParentWindow, aWindowId, aPosition, aSize, aGalType )
// Load display options (such as filled/outline display of items).
// Can be made only if the parent window is an EDA_DRAW_FRAME (or a derived class)
// which is not always the case (namely when it is used from a wxDialog like the pad editor)
EDA_DRAW_FRAME* frame = dynamic_cast<EDA_DRAW_FRAME*>( aParentWindow );
EDA_DRAW_FRAME* frame = GetParentEDAFrame();
if( frame )
{