← Back to team overview

kicad-developers team mailing list archive

[PATCH] Reset tool transitions even when already active (Fixes lp:1733224)

 

Tom, you might want to take a look at this one.

I was looking into this bug and noticed some odd behavior and I'm not quite
sure what the intended behavior is:
https://bugs.launchpad.net/kicad/+bug/1733224

When EDIT_TOOL::Main() is activated by move hotkey, transitions are reset
and other edit tool actions can be issued (for example, Rotate).  But you
can also hit M again, which sends another event to start the Main(), and
since the tool is already active, transitions are not reset.

The attached patch changes this, and seems to work fine, but I'm not sure
if there is some reason why it was not done this way.

Thanks,
Jon
From 78c1922d39172082ca54b50af4d027790e24db31 Mon Sep 17 00:00:00 2001
From: Jon Evans <jon@xxxxxxxxxxxxx>
Date: Sun, 26 Nov 2017 20:21:00 -0500
Subject: [PATCH] Reset tool transitions even when already active (Fixes
 lp:1733224)

---
 common/tool/tool_manager.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/common/tool/tool_manager.cpp b/common/tool/tool_manager.cpp
index e68c1285a..4bf9cb448 100644
--- a/common/tool/tool_manager.cpp
+++ b/common/tool/tool_manager.cpp
@@ -358,6 +358,9 @@ bool TOOL_MANAGER::runTool( TOOL_BASE* aTool )
 
     TOOL_ID id = aTool->GetId();
 
+    if( aTool->GetType() == INTERACTIVE )
+        static_cast<TOOL_INTERACTIVE*>( aTool )->resetTransitions();
+
     // If the tool is already active, bring it to the top of the active tools stack
     if( isActive( aTool ) )
     {
@@ -368,9 +371,6 @@ bool TOOL_MANAGER::runTool( TOOL_BASE* aTool )
 
     aTool->Reset( TOOL_INTERACTIVE::RUN );
 
-    if( aTool->GetType() == INTERACTIVE )
-        static_cast<TOOL_INTERACTIVE*>( aTool )->resetTransitions();
-
     // Add the tool on the front of the processing queue (it gets events first)
     m_activeTools.push_front( id );
 
-- 
2.14.1


Follow ups