Crash while turning bluetooth off with active headset


#1

While listening to audio using a bluetooth headset on my Macbook Air, if I turn off bluetooth completely I get a crash in juce_mac_CoreAudio.cpp in updateDetailsFromDevice() on the line bufferSizes.clear():

SonicWeb(6702,0x7fff7a217180) malloc: *** error for object 0x10229d1b0: pointer being freed was not allocated

This happens everytime I am turning off bluetooth of the Mac while using a bluetooth headset. It seems the CoreAudioIODevice is not happy that the complete audio device is going away.

There is no crash when turning of the bluetooth headset itself.


#2

bufferSizes is just an Array, so for it to fail like that rather implies that the entire object has been corrupted. Maybe something is happening such that a different thread, or re-entrant callback of some kind is deleting the CoreAudioInternal object just before it gets to that point in the code?

(I don’t have any suitable bluetooth gear to test this myself, I’m afraid!)


#3

Verified in my app. Same error, same place.