On 27.04.2010, at 23:22, Gary L. Wade wrote:
> Calling -retainCount
> immediately before and after the -setDelegate call is pretty much the only
> way.

Nope. It'll only lead to pain and suffering. And false positives. What if 
setDelegate was implemented thus:

-(void) setDelegate: (id)dele
{
    mDelegate = dele;

    [self detachNewThreadSelector: @selector(useDelegateOnThread:) withObject: 
dele];
}

This will retain the delegate to hand it off to the other thread. Depending on 
how long that other thread takes and how good a day your scheduler has, the 
thread may be finished and mDelegate may contain a weak reference to the 
delegate, or the thread may take longer, and then your code looking at the 
retain count will think it was a strong reference.

There is no substitute to reading the documentation.

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to