• 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: Trouble with performSelector afterDelay
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trouble with performSelector afterDelay


  • Subject: Re: Trouble with performSelector afterDelay
  • From: Jens Alfke <email@hidden>
  • Date: Mon, 14 Jul 2008 17:49:41 -0700


On 14 Jul '08, at 4:12 PM, Shawn Erickson wrote:

It looks like you override release in your "Worker" object (based on
the back trace you posted). Are you thinking -[Worker release] is the
place to free resources? If so it isn't the right place. You want
-[Worker dealloc].

Right. -release just decrements the refcount; it's the counterpart to - retain.


I'm uncomfortable with the idea of overriding retain/release/ retainCount. I know that some Apple docs suggest doing so for singleton objects, but I don't think it's necessary. All you really need to do is provide a +sharedInstance method like

+ (Worker*) sharedInstance {
	static Worker *sInstance;
	if( ! sInstance ) sInstance = [[self alloc] init];
	return sInstance;
}

—Jens

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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

References: 
 >Trouble with performSelector afterDelay (From: "James Trankelson" <email@hidden>)
 >Re: Trouble with performSelector afterDelay (From: Jens Alfke <email@hidden>)
 >Re: Trouble with performSelector afterDelay (From: "James Trankelson" <email@hidden>)
 >Re: Trouble with performSelector afterDelay (From: Ken Thomases <email@hidden>)
 >Re: Trouble with performSelector afterDelay (From: "James Trankelson" <email@hidden>)
 >Re: Trouble with performSelector afterDelay (From: "Shawn Erickson" <email@hidden>)

  • Prev by Date: Re: Creating and App menu from Scratch
  • Next by Date: Design question
  • Previous by thread: Re: Trouble with performSelector afterDelay
  • Next by thread: Rounded NSWindow corners?
  • Index(es):
    • Date
    • Thread