Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory Leak from KeyCombo Dictionary Extension #18

Open
ajkendall opened this issue Nov 10, 2019 · 0 comments
Open

Memory Leak from KeyCombo Dictionary Extension #18

ajkendall opened this issue Nov 10, 2019 · 0 comments

Comments

@ajkendall
Copy link

ajkendall commented Nov 10, 2019

I am getting a memory leak using instruments that goes away as soon as I comment out the KeyCombo dictionary extension... below is the code I am using - any chance you can take a look?

deployment target: 10.15
xcode version: 11.2

@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {

    var myHotkey: HotKey? {
        didSet {
            guard let myHotkey = myHotkey else { return }
            myHotkey.keyDownHandler = { [weak self] in
                self?.hotkeyHandler()
            }
        }
    }

    var num: Int = 0

    func applicationDidFinishLaunching(_ aNotification: Notification) {
        self.myHotkey = HotKey(carbonKeyCode: UInt32(47), carbonModifiers: UInt32(2304))
    }

    func hotkeyHandler() {
        self.num += 1
        print("hotkey pressed \(num) times")

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

No branches or pull requests

1 participant