Browse Source

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
pull/15/head
Seth Hillbrand 6 years ago
parent
commit
f2bf9fa534
  1. 1
      common/eda_base_frame.cpp
  2. 5
      eeschema/tools/sch_move_tool.cpp

1
common/eda_base_frame.cpp

@ -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 );

5
eeschema/tools/sch_move_tool.cpp

@ -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

Loading…
Cancel
Save