diff --git a/common/tool/tools_holder.cpp b/common/tool/tools_holder.cpp index d37aaaa7a9..1d2915a01c 100644 --- a/common/tool/tools_holder.cpp +++ b/common/tool/tools_holder.cpp @@ -43,7 +43,15 @@ TOOLS_HOLDER::TOOLS_HOLDER() : // TODO: Implement an RAII mechanism for the stack PushTool/PopTool pairs void TOOLS_HOLDER::PushTool( const std::string& actionName ) { - m_toolStack.push_back( actionName ); + if( m_toolStack.size() && m_toolStack.back() == actionName ) + { + // Tool already on the stack; we don't need to push again. (Happens when one tool is + // popped due to the activation of the same tool that is underneath it on the stack.) + } + else + { + m_toolStack.push_back( actionName ); + } // Human cognitive stacking is very shallow; deeper tool stacks just get annoying if( m_toolStack.size() > 3 ) diff --git a/eeschema/tools/sch_move_tool.cpp b/eeschema/tools/sch_move_tool.cpp index 8685044b0a..feb5c02ae0 100644 --- a/eeschema/tools/sch_move_tool.cpp +++ b/eeschema/tools/sch_move_tool.cpp @@ -379,13 +379,13 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent ) //------------------------------------------------------------------------ // Handle cancel // - else if( evt->IsCancelInteractive() ) + else if( evt->IsCancelInteractive() || evt->IsActivate() ) { - if( m_moveInProgress ) - { + if( m_moveInProgress && evt->IsCancelInteractive() ) evt->SetPassEvent( false ); + + if( m_moveInProgress ) restore_state = true; - } break; }