MASShortcut
MASShortcut copied to clipboard
Event deadlock in MASShortcutView.m
I'm using the MASShortcutView inside an NSTableView which is inside an NSPopover. The popover autoreleases its memory with a delay on closing it. What this causes is that the MASShortcutView inside the table cell gets deallocated with a delay thereby triggering [self activateEventMonitoring:NO];
with a delay as well. Since the dealloc happens after this delay, and if another NSPopover is opened in the mean time, the [self activateEventMonitoring:YES];
triggers before the dealloc causing the event monitor to be re-registered first and then removed (incorrectly) on the dealloc.
To be clear: Open popover -> Click on an MASShortcutView to trigger recording -> Set the new shortcut -> Close popover -> Open popover -> Click again on an MASShortcutView -> Can't set the new shortcut since the dealloc happens around this time for the old popover.
Thank you for the report! So it should be a counter and methods beginEventMonitoring
/ endEventMonitoring
which stops monitoring when it reaches zero 🤔 Would this help?
Yup. I think that should work. Thanks!