Re: Cocoa-dev Digest, Vol 7, Issue 1076
Re: Cocoa-dev Digest, Vol 7, Issue 1076
- Subject: Re: Cocoa-dev Digest, Vol 7, Issue 1076
- From: George Nachman <email@hidden>
- Date: Thu, 2 Dec 2010 11:26:28 -0800
>
> Message: 9
> Date: Tue, 23 Nov 2010 05:16:58 -0500
> From: Bill Cheeseman <email@hidden>
> Subject: Re: Odd problem with event taps when job is killed
> To: Cocoa-Dev Mail Cocoa-Dev <email@hidden>
> Message-ID: <email@hidden>
> 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 - email@hidden
>
>
>
>
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 (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