CoreMIDI + Native Extension == CRASH
Copy link to clipboard
Copied
I've run into a huge problem on MacOS (10.6) while developing a MIDI based ANE.
Wherever CoreMIDI is used, the app (ADL) crashes during shutdown. This happens regardless of dispose() being called on the extension. I've tried this with both the 3.1 and 3.2 SDKs, and with both C and C++ implementations (both under Xcode).
I've narrowed it down to something with the runloop being (perhaps) over-released.
The simplest test case to reproduce the bug is to include this code in your initializer. This creates and then immediately releases a MIDI client:
MIDIClientRef midiClientRef;
MIDIClientCreate( CFSTR("MIDIClient"), NULL, NULL, &midiClientRef );
MIDIClientDispose( midiClientRef );
midiClientRef = NULL;
After this is executed, the parent AIR app will crash when shutdown.
Strictly speaking, the call to dispose the MIDI client is not required. MIDIServices sticks around (once the client is created) and is cleaned up by the CoreMIDI framework when the app closes:
I've tried it both with and without, with the same resulting crash.
I've been hacking away at this one for days now and have run out of ideas. I'm hoping someone here might have some knowledge on the subject. The specific crash report follows.
Thanks!
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000014992c51
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Thread 0 Crashed: Dispatch queue: com.apple.main-thread
0 ??? 0x14992c51 0 + 345582673
1 com.apple.CoreFoundation 0x9767e3fb __CFBasicHashRehash + 1739
2 com.apple.CoreFoundation 0x976a47e0 CFBasicHashRemoveValue + 1264
3 com.apple.CoreFoundation 0x976dcbac CFRunLoopRemoveSource + 460
4 com.apple.audio.CoreAudio 0x999e83b7 HALRunLoop::RemoveSource(__CFRunLoopSource*) + 151
5 com.apple.audio.CoreAudio 0x999e8bfe HALPowerManagement::Teardown() + 96
6 com.apple.audio.CoreAudio 0x999e85da HALSystem::TeardownShell() + 50
7 com.apple.audio.CoreAudio 0x999e78f7 HALSystem::AtExitHandler() + 123
8 com.apple.audio.CoreAudio 0x999e7826 HALAtExit::AtExitHandler() + 78
9 libSystem.B.dylib 0x93ae8c0a __cxa_finalize + 219
10 libSystem.B.dylib 0x93ae8b14 exit + 33
11 com.adobe.AIR 0x01488861 0x1000000 + 4753505
12 com.apple.Foundation 0x97aafdb3 _nsnote_callback + 176
13 com.apple.CoreFoundation 0x976d5763 __CFXNotificationPost + 947
14 com.apple.CoreFoundation 0x976d516a _CFXNotificationPostNotification + 186
15 com.apple.Foundation 0x97aa4c50 -[NSNotificationCenter postNotificationName:object:userInfo:] + 128
16 com.apple.Foundation 0x97ab205d -[NSNotificationCenter postNotificationName:object:] + 56
17 com.apple.AppKit 0x920ac167 -[NSApplication terminate:] + 713
18 com.apple.Foundation 0x97ac6369 __NSFireDelayedPerform + 537
19 com.apple.CoreFoundation 0x976b8a3b __CFRunLoopRun + 8059
20 com.apple.CoreFoundation 0x976b63c4 CFRunLoopRunSpecific + 452
21 com.apple.CoreFoundation 0x976b61f1 CFRunLoopRunInMode + 97
22 com.apple.HIToolbox 0x95794e04 RunCurrentEventLoopInMode + 392
23 com.apple.HIToolbox 0x95794af5 ReceiveNextEventCommon + 158
24 com.apple.HIToolbox 0x95794a3e BlockUntilNextEventMatchingListInMode + 81
25 com.apple.AppKit 0x91e73595 _DPSNextEvent + 847
26 com.apple.AppKit 0x91e72dd6 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 156
27 com.apple.AppKit 0x91e351f3 -[NSApplication run] + 821
28 com.adobe.AIR 0x0100841a 0x1000000 + 33818
29 com.adobe.AIR 0x0100857b 0x1000000 + 34171
30 adl 0x00003013 RuntimeMain(char const*, int) + 333
31 adl 0x0000293d start + 53
Copy link to clipboard
Copied
I'll look into this tomorrow, in the meantime could you please open a new bug report on this over at bugbase.adobe.com? Please post back with the URL so that others affected can add their comments and votes.
Copy link to clipboard
Copied
Thank you for looking at this. The bug ID is 3163343.
Copy link to clipboard
Copied
Sorry I can't help with this problem but I am searching for an .ane to enable coreMIDI via AS3 on IOS. Is such an extension available somewhere? I can't seem to find it.
Copy link to clipboard
Copied
