Commit 035b231b authored by Maciej Suminski's avatar Maciej Suminski

Refinement for fix in 5497.

parent 4ad48982
...@@ -467,6 +467,8 @@ PCB_EDIT_FRAME::~PCB_EDIT_FRAME() ...@@ -467,6 +467,8 @@ PCB_EDIT_FRAME::~PCB_EDIT_FRAME()
void PCB_EDIT_FRAME::SetBoard( BOARD* aBoard ) void PCB_EDIT_FRAME::SetBoard( BOARD* aBoard )
{ {
bool new_board = ( aBoard != m_Pcb );
PCB_BASE_FRAME::SetBoard( aBoard ); PCB_BASE_FRAME::SetBoard( aBoard );
if( IsGalCanvasActive() ) if( IsGalCanvasActive() )
...@@ -484,7 +486,9 @@ void PCB_EDIT_FRAME::SetBoard( BOARD* aBoard ) ...@@ -484,7 +486,9 @@ void PCB_EDIT_FRAME::SetBoard( BOARD* aBoard )
{ {
m_toolManager->SetEnvironment( aBoard, drawPanel->GetView(), m_toolManager->SetEnvironment( aBoard, drawPanel->GetView(),
drawPanel->GetViewControls(), this ); drawPanel->GetViewControls(), this );
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
if( new_board )
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
} }
} }
} }
......
...@@ -88,8 +88,17 @@ SELECTION_TOOL::~SELECTION_TOOL() ...@@ -88,8 +88,17 @@ SELECTION_TOOL::~SELECTION_TOOL()
void SELECTION_TOOL::Reset( RESET_REASON aReason ) void SELECTION_TOOL::Reset( RESET_REASON aReason )
{ {
// Restore previous properties of selected items and remove them from containers if( aReason == TOOL_BASE::MODEL_RELOAD )
clearSelection(); {
// Remove pointers to the selected items from containers
// without changing their properties (as they are already deleted
// while a new board is loaded)
m_selection.group->Clear();
m_selection.clear();
}
else
// Restore previous properties of selected items and remove them from containers
clearSelection();
m_frame = getEditFrame<PCB_BASE_FRAME>(); m_frame = getEditFrame<PCB_BASE_FRAME>();
m_locked = true; m_locked = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment