bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Notifications sent in -(void)dealloc


From: Marcus Müller
Subject: Re: Notifications sent in -(void)dealloc
Date: Tue, 13 Aug 2002 23:49:53 +0200

On Mittwoch, August 7, 2002, at 03:49 Uhr, Richard Frith-Macdonald wrote:

It *was* modified to behave the same way as the MacOS-X implementation (slightly different from
what the MacOS-X documentation says) and documented.

The problem here is not with the retain/release/dealloc in NSObject, rather it is that the implementations of NSNotificationCenter differ slightly (though I've now rewritten the GNUstep stuff to be like the
MacOS-X stuff).

The order of execution went like this -

[...]

However ... this is not really a gnustep bug ... rather it's highlighting the fact that it's generally bad to do anything in a dealloc method which could conceivably cause the object being deallocated to be retained and released later - so good practice (where you *must* pass the object being deallocated to other methods) is to at least create/destroy an autorelease pool around those methods - that doesn't
eliminate all possible problems, but it deals with most.

Hi Richard,

just came back from a short trip to Barcelona. Thanks for the fix. Regarding your advise - you're perfectly right here. I wouldn't regard doing stuff like that as "best practice" either. However, in one particular case - dealloc notifications - it's exactly what one needs to do. In my case I have to inform proxies of a connection death (which occurs i.e. as a side effect of that connection being dealloced, hence the notification death is actually posted in that notification's -(void)dealloc). Such is life (or death). ;-)

Cheers,

  Marcus

--
Marcus Mueller  .  .  .  crack-admin/coder ;-)
Mulle kybernetiK  .  http://www.mulle-kybernetik.com
Current projects: finger znek@mulle-kybernetik.com





reply via email to

[Prev in Thread] Current Thread [Next in Thread]