Skip navigation.
 
mlNSArrayController and retainCount
FROM : Steve Moore
DATE : Thu Nov 04 19:43:11 2004

Hello,

I have an NSArrayController (staffController) instantiated in my .nib
file.  It is bound to an NSMutableArray in MyDocument.  In MyDocument's
windowControllerDidLoadNib method I checked the retainCount of the
staffController (the first line in the method) and it returns a value
of 43.  This seems odd.  I have another NSArrayController
(locumsController) that returns a retainCount of 10 at the same time. 
What accounts for these unusually high values?

The reason I am asking is that I am getting the dreaded "An instance
0x342de0 of class MyDocument is being deallocated while key value
observers are still registered with it.  Break on _NSKVODeallocateLog
to start debugging." message in the Run Log on application termination.
  When I check in MyDocument's addObserver: forKeyPath: options:
context: method only these two observers (staffController and
locumsController) are being added (one for key "StaffDoctors" and the
other for "LocumsDoctors").  Unfortunately, when I call MyDocument's
removeObserver:staffController forKeyPath:@"StaffDoctors" and a similar
call for the locumsController, I still get the same message in the Run
Log.  Admittedly, as far as I can tell the message is nothing but a
nuisance, but it bugs me to see it popping up all the time as though I
am doing something horribly wrong.  Any advice on how to rid myself of
these messages?  Or any idea on why these retainCounts are so
counter-intuitive?

Thanks,
  Steve Moore.

Related mailsAuthorDate
mlNSArrayController and retainCount Steve Moore Nov 4, 19:43
mlRe: NSArrayController and retainCount Scott Stevenson Nov 4, 23:14
mlRe: NSArrayController and retainCount Steve Moore Nov 4, 23:44
mlRe: NSArrayController and retainCount Scott Stevenson Nov 5, 02:46
mlRe: NSArrayController and retainCount Steve Moore Nov 5, 05:16