Skip to content
This repository has been archived by the owner on Mar 5, 2023. It is now read-only.

Event deadlock in MASShortcutView.m #91

Open
dsanghan opened this issue Apr 26, 2016 · 2 comments
Open

Event deadlock in MASShortcutView.m #91

dsanghan opened this issue Apr 26, 2016 · 2 comments

Comments

@dsanghan
Copy link

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.

@shpakovski
Copy link
Collaborator

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?

@dsanghan
Copy link
Author

Yup. I think that should work. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants