>
> Message: 9
> Date: Tue, 23 Nov 2010 05:16:58 -0500
> From: Bill Cheeseman <wjcheese...@gmail.com>
> Subject: Re: Odd problem with event taps when job is killed
> To: Cocoa-Dev Mail Cocoa-Dev <cocoa-dev@lists.apple.com>
> Message-ID: <80e43f4f-a032-4452-bb1f-80f7b7bf7...@gmail.com>
> Content-Type: text/plain;       charset=us-ascii
>
>
> 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 - b...@cheeseman.name
>
>
>
>
Apologies for the delay, I was on vacation.
I narrowed down the problem a bit, and that solution would not work. The
problem occurs when you do this:

1. Start program in debugger
2. Program registers an event tap
3. Break the program (for example, by choosing Pause from the Run menu in
Xcode, or pressing ^C in gdb)
4. Type some stuff
5. Kill the program
6. Everything you typed after step 5 is repeated by the "ghost".

My program never has a chance to remove its event tap. Luckily this won't
affect users, so I guess I will shake my fist at the universe and move on :)
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to