[1.1.4] IDE: HotKey Events called even after terminating script caused by an exception --- fixed 2019-01-06 build#178

Bug #1810640 reported by Michael Bvhm on 2019-01-06
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Sikuli
Critical
RaiMan

Bug Description

HotKey events are called efen if the script raises an error or exits. example:

def F10(event):
    print "F10"
def F11(event):
    print "F11"
def F12(event):
    print "F12"
def PGUP(event):
    print "PGUP"

Env.addHotkey(Key.F10, KeyModifier.CTRL, F10)
Env.addHotkey(Key.F11, KeyModifier.CTRL, F11)
Env.addHotkey(Key.F12, KeyModifier.CTRL, F12)
Env.addHotkey(Key.PAGE_UP, KeyModifier.CTRL, PGUP)

a=1/0
exit()

Results:

[error] script [ test ] stopped with error at line --unknown--
[error] Error caused by: Traceback (most recent call last): File "C:\temp\SikuliX\test.sikuli\test.py", line 17, in <module> a=1/0 ZeroDivisionError: integer division or modulo by zero

F10

F11

F12

PGUP

You can see, the functions are called even after the division by zero.
Fun Fact: In case i now change the function, for instance:

change UP to DOWN: Env.addHotkey(Key.PAGE_DOWN, KeyModifier.CTRL, PGUP)
actually I did not add it! Only alter the 4 characters.

Both keys are now reacting, having only one of them in the code.
Restart the IDE make the keys go away. (and of course unassignment - however that's not possible in case of errors)

Apparently the cleanup, that is done at normal script termination, is not done in this case.
I will fix asap.

summary: - HotKey Events called even after exit and error
+ [1.1.4] HotKey Events called even after exiting script with an exception
summary: - [1.1.4] HotKey Events called even after exiting script with an exception
+ [1.1.4] IDE: HotKey Events called even after terminating script caused
+ by an exception
Changed in sikuli:
status: New → Fix Committed
importance: Undecided → High
assignee: nobody → RaiMan (raimund-hocke)
milestone: none → 1.1.4
RaiMan (raimund-hocke) on 2019-01-06
Changed in sikuli:
importance: High → Critical
RaiMan (raimund-hocke) wrote :

should be fixed.
a test is appreciated.

summary: [1.1.4] IDE: HotKey Events called even after terminating script caused
- by an exception
+ by an exception --- fixed 2019-01-06 build#178
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers