Defer canvas type setting save until destruction of EDA_DRAW_FRAME

Fixes: lp:1741787
* https://bugs.launchpad.net/kicad/+bug/1741787
This commit is contained in:
Jon Evans 2018-01-11 23:02:18 -05:00 committed by Maciej Suminski
parent 47d392d83e
commit b21f301097
4 changed files with 17 additions and 2 deletions

View File

@ -142,6 +142,8 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
m_hotkeysDescrList = NULL;
m_canvas = NULL;
m_canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE;
m_canvasTypeDirty = false;
m_galCanvas = NULL;
m_galCanvasActive = false;
m_actions = NULL;
@ -216,6 +218,9 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
EDA_DRAW_FRAME::~EDA_DRAW_FRAME()
{
if( m_canvasTypeDirty )
saveCanvasTypeSetting( m_canvasType );
delete m_actions;
delete m_toolManager;
delete m_toolDispatcher;

View File

@ -563,10 +563,12 @@ void GERBVIEW_FRAME::SwitchCanvas( wxCommandEvent& aEvent )
break;
}
saveCanvasTypeSetting( canvasType );
UseGalCanvas( use_gal );
wxUpdateUIEvent e;
OnUpdateSwitchCanvas( e );
m_canvasType = canvasType;
m_canvasTypeDirty = true;
}

View File

@ -141,6 +141,12 @@ protected:
/// One-shot to avoid a recursive mouse event during hotkey movement
bool m_movingCursorWithKeyboard;
/// Flag indicating that drawing canvas type needs to be saved to config
bool m_canvasTypeDirty;
/// The current canvas type
EDA_DRAW_PANEL_GAL::GAL_TYPE m_canvasType;
void SetScreen( BASE_SCREEN* aScreen ) { m_currentScreen = aScreen; }
/**

View File

@ -975,7 +975,9 @@ void PCB_BASE_FRAME::SwitchCanvas( wxCommandEvent& aEvent )
}
UseGalCanvas( use_gal );
saveCanvasTypeSetting( canvasType );
m_canvasType = canvasType;
m_canvasTypeDirty = true;
}