eeschema: Prevent crash on move/drag re-entry

Restarting a move/drag operation breaks the stack by starting the tool
without popping it on exit.

TODO: implement RAII for these stack push/pop
This commit is contained in:
Seth Hillbrand 2019-09-11 16:59:16 -07:00
parent ae79a2bdcf
commit f2bf9fa534
2 changed files with 3 additions and 3 deletions

View File

@ -161,6 +161,7 @@ EDA_BASE_FRAME::~EDA_BASE_FRAME()
}
// TODO: Implement an RAII mechanism for the stack PushTool/PopTool pairs
void EDA_BASE_FRAME::PushTool( const std::string& actionName )
{
m_toolStack.push_back( actionName );

View File

@ -119,9 +119,6 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
else
return 0;
std::string tool = aEvent.GetCommandStr().get();
m_frame->PushTool( tool );
if( m_moveInProgress )
{
auto sel = m_selectionTool->GetSelection().Front();
@ -160,6 +157,8 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
TOOL_EVENT* evt = const_cast<TOOL_EVENT*>( &aEvent );
VECTOR2I prevPos;
std::string tool = aEvent.GetCommandStr().get();
m_frame->PushTool( tool );
m_cursor = controls->GetCursorPosition();
// Main loop: keep receiving events