Race condition in CoreAudioIODeviceType::scanForDevices()?


#1

Race condition in CoreAudioIODeviceType::scanForDevices()??

CoreAudioIODeviceType::scanForDevices() is called from OS via CoreAudioIODeviceType::hardwareListenerProc().

On the other hand, we can call CoreAudioIODeviceType::scanForDevices() from message-thread directly.
As a result, the private members (inputDeviceNames, outputDeviceNames, inputIds, outputIds) are racing,
and will occur crash.

SIGABRTjuce::StringArray::clear()
3    juce_HeapBlock.h juce::StringArray::clear()
4    juce_mac_CoreAudio.cpp scanForDevices
5    juce_mac_CoreAudio.cpp juce::CoreAudioClasses::CoreAudioIODeviceType::hardwareListenerProc(unsigned int, unsigned int, AudioObjectPropertyAddress const*, void*)

Do you have any idea to avoid crashes?


#2

A fix for this will appear on the develop branch shortly


#3

Oh, thanks :smiley: