Re: How to allocate and delegate; or how to keep GC and the static analyzer happy

2009-10-10 Thread Glen Low
All I have several cases of the following pattern in my code: - (void)start { [[Something alloc] initWithDelegate:self]; } - (void)finishWithSomething:(Something*)something { [something release]; } The intent of course is that the Something object calls back the caller with

Re: How to allocate and delegate; or how to keep GC and the static analyzer happy

2009-10-10 Thread Jens Alfke
On Oct 10, 2009, at 2:25 AM, Glen Low wrote: Not necessarily. In a pathological but presumably legit case, whatever happens in initDelegate: might only form a weak reference to the Something object, thus the Something object would be subject to GC. That's true, although unlikely. In

Re: How to allocate and delegate; or how to keep GC and the static analyzer happy

2009-10-10 Thread Glen Low
On 10/10/2009, at 12:29 PM, Jens Alfke wrote: On Oct 8, 2009, at 7:33 PM, Glen Low wrote: 1. The code is not GC friendly as between the end of start and the beginning of finishWithSomething, there are no references to the object, so it may be collected. There must be references to it;

Re: How to allocate and delegate; or how to keep GC and the static analyzer happy

2009-10-09 Thread Jens Alfke
On Oct 8, 2009, at 7:33 PM, Glen Low wrote: 1. The code is not GC friendly as between the end of start and the beginning of finishWithSomething, there are no references to the object, so it may be collected. There must be references to it; otherwise how would that object's methods get

How to allocate and delegate; or how to keep GC and the static analyzer happy

2009-10-08 Thread Glen Low
Hi All I have several cases of the following pattern in my code: - (void)start { [[Something alloc] initWithDelegate:self]; } - (void)finishWithSomething:(Something*)something { [something release]; } The intent of course is that the Something object calls back the caller