Race condition in CoreAudioIODeviceType::scanForDevices()?


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.

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?


A fix for this will appear on the develop branch shortly


Oh, thanks :smiley: