This has mostly been working fine, but now I'm occasionally getting crashes. Is NSSound thread-safe? Now that I look, I can't find any documentation; the Cocoa thread safety docs don't refer to NSSound at all.
The crash looks like: Thread 6 Crashed:0 com.apple.CoreFoundation 0x9486f1ac CFBundleGetFunctionPointerForName + 32 1 ...ple.CoreServices.CarbonCore 0x9151b2b4 _cf_lookupLibraryEntry(rtFile*, short, RegisteredComponent*) + 244 2 ...ple.CoreServices.CarbonCore 0x9151b2b4 _cf_lookupLibraryEntry(rtFile*, short, RegisteredComponent*) + 244
3 ...ple.CoreServices.CarbonCore 0x914b3fc8 LoadComponent + 248 4 ...ple.CoreServices.CarbonCore 0x914b3d3c OpenAComponent + 256 5 ...ple.CoreServices.CarbonCore 0x914b3c24 OpenComponent + 16 6 com.apple.AppKit 0x90f143a8 _initializeCA + 7967 com.apple.AppKit 0x90f13f90 -[NSSound _postInitialization] + 352 8 com.apple.AppKit 0x90f13d50 -[NSSound initWithContentsOfURL:byReference:] + 256 9 com.apple.AppKit 0x91226070 +[NSSound _searchForSoundNamed:] + 512 10 com.apple.AppKit 0x9122618c +[NSSound soundNamed:] + 212 11 com.mooseyard.Cloudy 0x00003b54 -[MyClass _bg_playSoundNamed:] + 356
12 com.apple.Foundation 0x95b5fdec __NSThread__main__ + 1004 13 libSystem.B.dylib 0x95e39658 _pthread_start + 316All I'm doing is using a -performSelectorOnBackgroundThread: to call the following:
- (void) _bg_playSoundNamed: (NSString*)name
{
NSAutoreleasePool *pool = [NSAutoreleasePool new];
NSSound *sound = [NSSound soundNamed: name];
if(sound) {
sound.volume = _volume;
[sound play];
} else
Warn(@"Couldn't load sound named '%@'",name);
[pool drain];
}
—Jens
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Cocoa-dev mailing list ([email protected]) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
