尝试加载系统声音时NSSound崩溃

时间:2011-09-27 09:56:30

标签: cocoa crash crash-reports nssound

在尝试加载系统声音时,我的Cocoa应用程序偶尔会崩溃。我自己无法重现这一点,但有些用户向我发送了崩溃报告。

堆栈跟踪始终相同(见下文)。该应用程序打开一个模态对话框,用户单击确定,声音已加载并崩溃:

[NSSound soundNamed:@"Hero"];

网上有一些关于这个问题的提及[1],但没有解决方案。请注意我正在加载来自主线程的声音,而不是试图播放它。它马上就崩溃了。此外,声音文件本身没有损坏(我有一个用户通过电子邮件发送给我,它与我安装的相匹配)。

崩溃日志摘录:

Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000009a0d204

VM Regions Near 0x9a0d204:
    shared memory          0000000009310000-0000000009511000 [ 2052K] r--/r-- SM=SHM  
--> MALLOC_TINY            0000000009a00000-0000000009c00000 [ 2048K] rw-/rwx SM=COW  
    MALLOC_LARGE           0000000009c00000-000000000bc9c000 [ 32.6M] rw-/rwx SM=PRV  

Application Specific Information:
objc[8625]: garbage collection is OFF
Performing @selector(ok:) from sender NSButton 0x236510

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   ???                             0x09a0d204 0 + 161534468
1   com.apple.audio.units.Components    0x7000ed9d AUHAL::AUHAL(ComponentInstanceRecord*, unsigned long, bool) + 775
2   com.apple.audio.units.Components    0x7002feff ComponentEntryPoint<DefaultOutputAU>::Dispatch(ComponentParameters*, DefaultOutputAU*) + 144
3   com.apple.CoreServices.CarbonCore   0x98487949 CallComponent + 223
4   com.apple.CoreServices.CarbonCore   0x98487992 CallComponentDispatch + 29
5   com.apple.CoreServices.CarbonCore   0x984f3b6c CallComponentOpen + 43
6   com.apple.CoreServices.CarbonCore   0x98486608 OpenAComponent + 426
7   com.apple.CoreServices.CarbonCore   0x98486688 OpenComponent + 24
8   com.apple.AppKit                0x9b810cd3 _initializeCA + 1115
9   com.apple.AppKit                0x9b811c23 -[NSSound _postInitialization] + 349
10  com.apple.AppKit                0x9b810609 -[NSSound initWithContentsOfURL:byReference:] + 263
11  com.apple.AppKit                0x9b812767 +[NSSound _searchForSoundNamed:] + 1044
12  com.apple.AppKit                0x9b8122de +[NSSound soundNamed:] + 227

1:http://lists.apple.com/archives/Cocoa-dev/2007/Oct/msg01159.html

1 个答案:

答案 0 :(得分:0)

您提到的问题的分辨率(或更确切地说是变通方法)已应用于传输changeset 3540不允许自定义声音以及稍后changeset 5577支持Leopard上的自定义用户声音

不幸的是,回溯不匹配,您的崩溃日志来自Snow Leopard或Lion,所以这些解决方案可能不适合您。我建议你向Apple提交bug report