• 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: why does this leak?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: why does this leak?


  • Subject: Re: why does this leak?
  • From: j o a r <email@hidden>
  • Date: Tue, 14 Feb 2006 21:29:06 +0100


On 14 feb 2006, at 03.08, Robert Dell wrote:

I think it was because I was forced to add a retain to it in order to keep the program from crashing.

You were not forced to add the retain, you choose to. If you fix problems the _wrong_ way, they will come back and bite you later.


Camillo is right on track, the menu is the owner of it's menu items, and will take care of their memory management. You should not retain the items you hand over to the menu, nor release them when you remove them from the menu.

A couple of other things from your email:

* This comment makes me scared:

"the menu updater gets updated every 1/10 of a second, i know, a little too often. it's going to be slowed down"

You have got to be kidding?! You can't run out and check the file system for changes 10 times per second! Use file system notifications (kqueues or other) to make sure you only update your menus when there are changes. At the very least, avoid updating the menu unless there have actually been changes in the file system when you poll - ie. keep an internal list and compare with what you found when you polled.

* This is not needed:
	  [pathToSongsFolder appendString: @"/"];

* In fact, why do you use the mutable string at all? It seems completely unnecessary as far as I can tell?

* When looking for @.song", it seems that you might want to investigate using NSBackwardsSearch and NSAnchoredSearch to make sure you're not getting false matches? Perhaps as an alternative make a case insensitive compare to just [pathToSongsFolder pathExtension].

* If you use "-addItemWithTitle:action:keyEquivalent:" to add items, you don't have to specify the index.

* I don't think you need to set the state to NSOffState, is that not the default?

j o a r


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

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: why does this leak?
      • From: Daniel Jalkut <email@hidden>
References: 
 >why does this leak? (From: Robert Dell <email@hidden>)
 >Re: why does this leak? (From: Charlton Wilbur <email@hidden>)
 >Re: why does this leak? (From: Robert Dell <email@hidden>)

  • Prev by Date: Re: Affine Transform
  • Next by Date: setting NSSlider floatvalue from different thread
  • Previous by thread: Re: why does this leak?
  • Next by thread: Re: why does this leak?
  • Index(es):
    • Date
    • Thread