Re: Odd problem with event taps when job is killed
Re: Odd problem with event taps when job is killed
- Subject: Re: Odd problem with event taps when job is killed
- From: Bill Cheeseman <email@hidden>
- Date: Tue, 23 Nov 2010 05:16:58 -0500
On Nov 22, 2010, at 5:14 PM, George Nachman wrote:
> I recently added an event tap to my program. Since doing that, there is a
> strange behavior: when I kill my job (usually by making a change in Xcode
> and pressing cmd-Enter, being prompted to kill the job, and selecting OK),
> it will repeat back the last 10-20 keypresses as or after it dies
You have to uninstall an event tap when you're through with it. Perhaps you aren't uninstalling it, and it lives on?
Apple engineer Mike Paquette explained how to do this in messages to the quartz-dev mailing list on 2007-03-18 and 2008-02-12:
CFMachPortInvalidate(tapMachPortRef); // switches off the event tap; invalidates tapRunLoopSourceRef, too, and drops retain counts on both by 1 so the CFRelease will release the objects and not leak
CFRunLoopRemoveSource(CFRunLoopGetCurrent(), tapRunLoopSourceRef, kCFRunLoopCommonModes);
CFRelease(tapRunLoopSourceRef);
CFRelease(tapMachPortRef);
--
Bill Cheeseman - email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden