• 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: A Mac App & helper NSStatusItem - how to share preferences
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A Mac App & helper NSStatusItem - how to share preferences


  • Subject: Re: A Mac App & helper NSStatusItem - how to share preferences
  • From: Steve Cronin <email@hidden>
  • Date: Tue, 30 Dec 2008 19:18:16 -0600

Michael;

OK to really perhaps beat the poor horse,  is the following kosher?

(NSDictionary *) prefDictionary {
return [(NSDictionary *)CFPreferencesCopyMultiple(NULL, appBundleID, kCFPreferencesCurrentUser, kCFPreferencesCurrentHost) autorelease];
}


Steve


Michael said:
Yep, this fixes the leak. Your Copy is balanced with a Release and all is well.


However, just to be really nitpicky, I'll point out that it's a bit
ugly. You build a new dictionary from the old one, then throw the old
one away. Better to just keep the old one around with something like
this:

return [(id)prefs autorelease];

Or if you're in a garbage collected environment:

return NSMakeCollectable(prefs);

(And you can do both if you're writing dual-mode code.)

_______________________________________________

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: A Mac App & helper NSStatusItem - how to share preferences
      • From: "Michael Ash" <email@hidden>
References: 
 >A Mac App & helper NSStatusItem - how to share preferences (From: Steve Cronin <email@hidden>)
 >Re: A Mac App & helper NSStatusItem - how to share preferences (From: "Kyle Sluder" <email@hidden>)
 >Re: A Mac App & helper NSStatusItem - how to share preferences (From: Steve Cronin <email@hidden>)
 >Re: A Mac App & helper NSStatusItem - how to share preferences (From: Steve Cronin <email@hidden>)

  • Prev by Date: Re: Display Format Pop-up on Open Panel
  • Next by Date: Re: [NSImageView animator] - will this animate setImage: ?
  • Previous by thread: Re: A Mac App & helper NSStatusItem - how to share preferences
  • Next by thread: Re: A Mac App & helper NSStatusItem - how to share preferences
  • Index(es):
    • Date
    • Thread