Skip navigation.
 
mlRe: use finalize for removing AppleEvent handlers in GC apps?
FROM : Sean McBride
DATE : Thu Jan 03 23:24:28 2008

On 12/22/07 2:19 PM, Todd Ditchendorf said:

>In my all-GC cocoa app, I'm registering an AppleEvent handler:
>
>
>[[NSAppleEventManager sharedAppleEventManager] setEventHandler:self
>                                                   
>andSelector:@selector(handleGetURLAppleEvent:withReplyEvent:)
>                                                 forEventClass:kInternetEventClass
>                                                    andEventID:kAEGetURL];
>
>
>It seems that before GC, you would remove this handler in the dalloc 
>method. (correct me if i'm wrong there)
>
>- (void)dealloc {
>    ...
>    [[NSAppleEventManager sharedAppleEventManager] 
>removeEventHandlerForEventClass:kInternetEventClass 
>andEventID:kAEGetURL];
>    ...
>}
>
>In a GC app, should you do that removal in finalize instead? or 
>somewhere else? or not at all?


Well, everything in -finalize has to be thread-safe.  Is
NSAppleEventManager thread safe?  If not, then -finalize is a very bad
place to do that.

--
____________________________________________________________
Sean McBride, B. Eng                <email_removed>
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada

Related mailsAuthorDate
mluse finalize for removing AppleEvent handlers in GC apps? Todd Ditchendorf Dec 22, 21:19
mlRe: use finalize for removing AppleEvent handlers in GC apps? Sean McBride Jan 3, 23:24
mlRe: use finalize for removing AppleEvent handlers in GC apps? Bill Bumgarner Jan 4, 00:10