Deallocation while key value observers still registered

2010-05-25 Thread Gideon King
Hi, I'm getting the message: An instance 0x11d0ce4b0 of class NMGeneralPrintAccessoryController was deallocated while key value observers were still registered with it. Observation info was leaked, and may even become mistakenly attached to some other object. Set a breakpoint on

Re: Deallocation while key value observers still registered

2010-05-25 Thread Roland King
what version of what operating system are you using? On 25-May-2010, at 9:14 PM, Gideon King wrote: Hi, I'm getting the message: An instance 0x11d0ce4b0 of class NMGeneralPrintAccessoryController was deallocated while key value observers were still registered with it. Observation info

Re: Deallocation while key value observers still registered

2010-05-25 Thread Gideon King
10.6.3 On 25/05/2010, at 11:17 PM, Roland King wrote: what version of what operating system are you using? On 25-May-2010, at 9:14 PM, Gideon King wrote: Hi, I'm getting the message: An instance 0x11d0ce4b0 of class NMGeneralPrintAccessoryController was deallocated while key value

Re: Deallocation while key value observers still registered

2010-05-25 Thread Roland King
That's not it then, in Snow Leopard there was a change so that message was only emitted at the end of the dealloc() method instead of at the start which allowed you to deregister your observers in dealloc() and not get this error. In Leopard and in (I think still in) iPhone OS you get the

Re: Deallocation while key value observers still registered

2010-05-25 Thread Kyle Sluder
On Tue, May 25, 2010 at 6:14 AM, Gideon King gid...@novamind.com wrote: An instance 0x11d0ce4b0 of class NMGeneralPrintAccessoryController was deallocated while key value observers were still registered with it. Observation info was leaked, and may even become mistakenly attached to some

Re: Deallocation while key value observers still registered

2010-05-25 Thread aglee
On May 25, 2010, at 10:54 AM, Kyle Sluder kyle.slu...@gmail.com wrote: This sounds off you're deregistering obeservers in your observee's -dealloc? In general this would sound off to me too, on the principle that observees normally don't know who their observers are. �It�only makes sense to me

Re: Deallocation while key value observers still registered

2010-05-25 Thread Kyle Sluder
On Tue, May 25, 2010 at 9:08 AM, aglee ag...@mac.com wrote: I had an idea for a perverse hack to deal with the problem in Leopard, which was to to override release and do the deregistering there if the retainCount is 1, thus sneaking in the deregistering just before dealloc but no sooner. I

Re: Deallocation while key value observers still registered

2010-05-25 Thread Simon ONeill
Hi, I had something perhaps similar. (But have no solution, only possible further information to add). I believe that registration came in my case from InterfaceBuilder, where I had used the keyed values as entries in various textFields, using IB setup bindings in an NSPanel. (Snow

Re: Deallocation while key value observers still registered

2010-05-25 Thread Gideon King
I have found the problem. In awakeFromNib, I have several calls like this: [self addObserver:self forKeyPath:@thingy options:NSKeyValueObservingOptionInitial|NSKeyValueObservingOptionNew context:NULL]; And in the dealloc method, I have: [self removeObserver:self forKeyPath:@thingy]; for all

Re: Deallocation while key value observers still registered

2010-05-25 Thread Sean McBride
On Wed, 26 May 2010 03:08:31 +1000, Gideon King said: I have found the problem. In awakeFromNib, I have several calls like this: [self addObserver:self forKeyPath:@thingy options:NSKeyValueObservingOptionInitial|NSKeyValueObservingOptionNew context:NULL]; And in the dealloc method, I have:

Re: Deallocation while key value observers still registered

2010-05-25 Thread Roland King
Sean McBride wrote: On Wed, 26 May 2010 03:08:31 +1000, Gideon King said: Glad you've tracked it down. Just a comment though: my understanding is that calling removeObserver from dealloc is, in general, discouraged. See here for some reasoning: http://www.karppinen.fi/analysistool/