-
Notifications
You must be signed in to change notification settings - Fork 8
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
curious about passRetained
in event tap callback
#25
Comments
I hate to break it to you but I'm no expert either. This has been the first and only macOS app I've ever created so far. For what it’s worth, I have never had a memory issue — Consumption-wise, it only uses 15MB at a startup and a week later. Anyway, now that you've mentioned it, I've tested both versions and examined the memory usage.
|
ah. thanks for taking the time. and sorry, i meant no macOS/iOS/Swift/Objective-C development here. i've heard about btw. thanks for making this repo public. inspiring, beautiful code. |
Oh, shoot. It was the other way around. Swapped the titles.
My pleasure. |
i can die peacefully in my sleep now \o/ thanks again for your time. |
Keyboard/keyboard/Core/EventManager.swift
Line 27 in 6ac1666
quite noob to macOS development here. been through some coding and loads of documentation in the past few weeks, and i don't get why
passRetained
is used in your event tap callback rather thanpassUnretained
. i'm pretty sure you're correct, but i can't reason why. from the doc (https://developer.apple.com/documentation/coregraphics/cgeventtapcallback#) it appears the event is owned by the caller. if you modify it, wouldn't you pass it without retaining it? if you usepassRetained
, then when do you release it?The text was updated successfully, but these errors were encountered: