Fixed a crash in pcbnew (GAL).
This commit is contained in:
parent
09d2d5367a
commit
2f874097ae
|
@ -52,6 +52,7 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin
|
||||||
wxScrolledCanvas( aParentWindow, aWindowId, aPosition, aSize )
|
wxScrolledCanvas( aParentWindow, aWindowId, aPosition, aSize )
|
||||||
{
|
{
|
||||||
m_parent = aParentWindow;
|
m_parent = aParentWindow;
|
||||||
|
m_edaFrame = dynamic_cast<EDA_DRAW_FRAME*>( aParentWindow );
|
||||||
m_gal = NULL;
|
m_gal = NULL;
|
||||||
m_backend = GAL_TYPE_NONE;
|
m_backend = GAL_TYPE_NONE;
|
||||||
m_view = NULL;
|
m_view = NULL;
|
||||||
|
@ -105,8 +106,6 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin
|
||||||
m_drawingEnabled = false;
|
m_drawingEnabled = false;
|
||||||
Connect( wxEVT_TIMER, wxTimerEventHandler( EDA_DRAW_PANEL_GAL::onRefreshTimer ), NULL, this );
|
Connect( wxEVT_TIMER, wxTimerEventHandler( EDA_DRAW_PANEL_GAL::onRefreshTimer ), NULL, this );
|
||||||
|
|
||||||
m_edaFrame = dynamic_cast<EDA_DRAW_FRAME*>( aParentWindow );
|
|
||||||
|
|
||||||
LoadGalSettings();
|
LoadGalSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -373,7 +372,7 @@ bool EDA_DRAW_PANEL_GAL::SwitchBackend( GAL_TYPE aGalType )
|
||||||
|
|
||||||
bool EDA_DRAW_PANEL_GAL::SaveGalSettings()
|
bool EDA_DRAW_PANEL_GAL::SaveGalSettings()
|
||||||
{
|
{
|
||||||
if( !m_edaFrame )
|
if( !m_edaFrame || !m_gal )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
wxConfigBase* cfg = Kiface().KifaceSettings();
|
wxConfigBase* cfg = Kiface().KifaceSettings();
|
||||||
|
@ -391,7 +390,7 @@ bool EDA_DRAW_PANEL_GAL::SaveGalSettings()
|
||||||
|
|
||||||
bool EDA_DRAW_PANEL_GAL::LoadGalSettings()
|
bool EDA_DRAW_PANEL_GAL::LoadGalSettings()
|
||||||
{
|
{
|
||||||
if( !m_edaFrame )
|
if( !m_edaFrame || !m_gal )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
wxConfigBase* cfg = Kiface().KifaceSettings();
|
wxConfigBase* cfg = Kiface().KifaceSettings();
|
||||||
|
|
|
@ -109,7 +109,7 @@ EDA_DRAW_PANEL_GAL( aParentWindow, aWindowId, aPosition, aSize, aGalType )
|
||||||
// Load display options (such as filled/outline display of items).
|
// 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)
|
// 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)
|
// 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 )
|
if( frame )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue