In MASShortcutView.m, -activateEventMonitoring: was implicitly retaining self in two places by using the _shortcutValidator variable. In certain cases, this caused the control to fail to recognize new keystrokes.
To see the problem in action, run the attached sample project. Click shortcut view, then press command-w to close the window (before a shortcut has been set). Open a new document window and click the shortcut view there - at this point modifier keys will not register in the view.
The reason seems to be that because self is retained buy the block, when the new control calls -activateEventMonitoring:, the old block and therefore the old self is dealloc'ed, which causes activateEventMonitoring: to be called a second time with NO.
In
MASShortcutView.m
,-activateEventMonitoring:
was implicitly retaining self in two places by using the_shortcutValidator
variable. In certain cases, this caused the control to fail to recognize new keystrokes.To see the problem in action, run the attached sample project. Click shortcut view, then press command-w to close the window (before a shortcut has been set). Open a new document window and click the shortcut view there - at this point modifier keys will not register in the view.
The reason seems to be that because self is retained buy the block, when the new control calls
-activateEventMonitoring:
, the old block and therefore the old self is dealloc'ed, which causesactivateEventMonitoring:
to be called a second time withNO
.TestApp.zip