eeschema: fix crash when the simulator frame is open and the Tune tool is actived.

In some cases when the Tune tool is actived and a symbol is selected, if the tool
is deactivated from the right toolbar in Eeschema, Eeschema crashes.
This commit is contained in:
jean-pierre charras 2021-10-22 17:40:40 +02:00
parent f72f637a06
commit 29756278e0
1 changed files with 7 additions and 0 deletions

View File

@ -890,6 +890,9 @@ int SCH_EDITOR_CONTROL::SimTune( const TOOL_EVENT& aEvent )
if( simFrame )
static_cast<SIM_PLOT_FRAME*>( simFrame )->AddTuner( symbol );
// We do not really want to keep a symbol selected in schematic,
// so clear the current selection
selTool->ClearSelection();
return true;
} );
@ -924,6 +927,10 @@ int SCH_EDITOR_CONTROL::SimTune( const TOOL_EVENT& aEvent )
m_toolMgr->GetTool<EE_SELECTION_TOOL>()->UnbrightenItem( m_pickerItem );
// Wake the selection tool after exiting to ensure the cursor gets updated
// and deselect previous selection from simulator to avoid any issue
// ( avoid crash in some cases when the SimTune tool is deselected )
EE_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
selectionTool->ClearSelection();
m_toolMgr->RunAction( EE_ACTIONS::selectionActivate, false );
} );