From 29756278e0bd92004e36b97c371d7b9d080c7bd6 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 22 Oct 2021 17:40:40 +0200 Subject: [PATCH] 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. --- eeschema/tools/sch_editor_control.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/eeschema/tools/sch_editor_control.cpp b/eeschema/tools/sch_editor_control.cpp index c5e327c17d..040210feb6 100644 --- a/eeschema/tools/sch_editor_control.cpp +++ b/eeschema/tools/sch_editor_control.cpp @@ -890,6 +890,9 @@ int SCH_EDITOR_CONTROL::SimTune( const TOOL_EVENT& aEvent ) if( simFrame ) static_cast( 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()->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(); + selectionTool->ClearSelection(); m_toolMgr->RunAction( EE_ACTIONS::selectionActivate, false ); } );