• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: menu madness with retain count
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: menu madness with retain count


  • Subject: Re: menu madness with retain count
  • From: Uli Kusterer <email@hidden>
  • Date: Wed, 28 Apr 2010 00:05:07 +0200

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 (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: menu madness with retain count
      • From: Bill Bumgarner <email@hidden>
    • Re: menu madness with retain count
      • From: Laurent Daudelin <email@hidden>
References: 
 >Re: menu madness with retain count (From: "Gary L. Wade" <email@hidden>)

  • Prev by Date: Re: menu madness with retain count
  • Next by Date: Re: menu madness with retain count
  • Previous by thread: Re: menu madness with retain count
  • Next by thread: Re: menu madness with retain count
  • Index(es):
    • Date
    • Thread