Re: Cocoa bug? release/removeObserver from inside observeValueForKeyPath

2008-05-30 Thread Kai
On 30.5.2008, at 00:53, Hamish Allan wrote: On Thu, May 29, 2008 at 11:15 PM, Geoff Schmidt [EMAIL PROTECTED] wrote: 3) If this is already known, is there a customary pattern for avoiding the problem? Never release from observeValueForKeyPath is a bit harsh! I don't know if it's known,

Re: Cocoa bug? release/removeObserver from inside observeValueForKeyPath

2008-05-30 Thread Geoff Schmidt
Thanks to Hamish and Kai for their suggestions - the help is much appreciated. For now, I'm just being careful to autorelease where there is a potential problem, as Kai suggested. (Though I suspect that, in general, it's equivalent to the halting problem to determine which instances of

Cocoa bug? release/removeObserver from inside observeValueForKeyPath

2008-05-29 Thread Geoff Schmidt
Suppose that two objects A and B are observing a key on a third object C. Suppose further that from its observeValueForKeyPath method, A releases B, causing B's dealloc method to be called, and that B's dealloc method properly calls removeObserver. Then, despite the call to removeObserver,

Re: Cocoa bug? release/removeObserver from inside observeValueForKeyPath

2008-05-29 Thread Hamish Allan
On Thu, May 29, 2008 at 11:15 PM, Geoff Schmidt [EMAIL PROTECTED] wrote: 3) If this is already known, is there a customary pattern for avoiding the problem? Never release from observeValueForKeyPath is a bit harsh! I don't know if it's known, but you could try [obj