[Top][All Lists]

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

sending notifications in -dealloc

From: Helge Hess
Subject: sending notifications in -dealloc
Date: Fri, 31 May 2002 15:37:02 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0rc3) Gecko/20020523


maybe someone has an obvious answer ... This code does work on MacOSX and libFoundation, but not on gstep-base:
- (void)dealloc {
  nc = [NSNotificationCenter defaultCenter];
  [nc postNotificationName:@"ContextWillDeallocate" object:self];
  [super dealloc];

I do this for weak references where I want to notify other observers that the context is deallocated (they will reset their non-retained pointer) ...

This doesn't work on gstep-base, because the NSNotification created retains and afterwards releases the "object:self". This somehow results in a duplicate call to -dealloc (because the RC apparently reaches "0" twice).

Is anyone aware of differences with regards to RC in -dealloc or has any other ideas ?


reply via email to

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