[1.1.0] Hotkey handlers do not properly clean up

Bug #1566637 reported by Sam Gleske
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SikuliX
Opinion
Undecided
RaiMan

Bug Description

OS: Mac OS X El Capitan 10.11.3 (15D21)
Sikuli 1.1.0

When you cancel a script use CMD+SHIFT+C (Mac) the Hotkeys remain active.

e.g.

#START SCRIPT
def doClick(some_location):
    last_mouse_location = Env.getMouseLocation()
    click(some_location)
    mouseMove(last_mouse_location)

def click_location(event):
    doClick(Location(100, 100))

Env.addHotkey('1', 0, click_location)
#END SCRIPT

Now run the sikuli script. If you cancel the script with CMD+SHIFT+C pressing the number 1 key will still execute the hotkey. I believe this should Env.removeHotkey all of the registered hotkeys if the script is canceled.

Revision history for this message
RaiMan (raimund-hocke) wrote :

tested with same environment:

why do you think, the hotkeys are not reset?

--- this is my test:
Debug.on(3)
def handler(e):
  print "***** in handler"

Env.addHotkey('1', 0, handler)

for i in range(20):
  print "*** lap:", i
  wait(1)

--- and this is the output

[debug] Jython: requested to use as default region: R[0,0 1280x800]@S(0)

[debug] JythonScriptRunner: runPython: running script from IDE:
/Users/raimundhocke/Desktop/SikuliX/testFFHandler.sikuli
[debug] HotkeyManager: add Hotkey: 1 (49, 0)
*** lap: 0
*** lap: 1
*** lap: 2
*** lap: 3
[debug] AbortKey was pressed
[debug] AbortKey was pressed, but nothing to stop here ;-)
[debug] Sikulix: cleanUp: 0

java.lang.InterruptedException: sleep interrupted
.... more traceback (fixed in 1.1.1)
at org.sikuli.script.Sikulix.cleanUp(Sikulix.java:485)
at org.sikuli.ide.SikuliIDE$ButtonRun$1.run(SikuliIDE.java:2385)

[debug] HotkeyManager: reset - removing all defined hotkeys.
[debug] removed (49, 0)

Changed in sikuli:
status: New → Opinion
assignee: nobody → RaiMan (raimund-hocke)
milestone: none → 1.1.1
milestone: 1.1.1 → 1.1.0
summary: - Hotkey handlers do not properly clean up
+ [1.1.0] Hotkey handlers do not properly clean up
Revision history for this message
Sam Gleske (sam-mxracer) wrote :

Odd, I can't actually reproduce it with the script I gave you. However, for unknown reasons yet that's the behavior in my script.

https://gist.github.com/samrocketman/12057af8bbf1463ca2a6

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.