• 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
NSSound & autorelease
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSSound & autorelease


  • Subject: NSSound & autorelease
  • From: Chris Silverberg <email@hidden>
  • Date: Sat, 21 Jun 2003 09:57:16 -0700
  • Organization: Silverberg.Net

Hello list,

A question... I've seen several developers doing this to play a sound:

[[NSSound soundNamed: @"YouHaveNewMail"] play];

So, is this really safe? NSSound returns an autoreleased instance of a
sound... and 'play' plays the sound asynchronously. What happens if this
sound is playing and the autorelease pool releases its objects?

Now, I could see that this would not be a problem if NSSound did a
self-retain when you call play... and it did a self-release when the sound
completed. But without documentation, I can't just assume that. Does
anyone know the real deal?

thanks much,
Chris
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: NSSound & autorelease
      • From: Daniel Jalkut <email@hidden>
  • Prev by Date: Re: NSTextField and key-events
  • Next by Date: memory usage monitoring
  • Previous by thread: Re: NSTextField and key-events
  • Next by thread: Re: NSSound & autorelease
  • Index(es):
    • Date
    • Thread