Merge pull request #12586 from kencooke/audio-peakmeters-fix

Fix crash when closing the Audio menu
This commit is contained in:
Ken Cooke 2018-03-13 07:52:37 -07:00 committed by GitHub
commit bcf893db18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -43,14 +43,19 @@ void AudioClient::checkPeakValues() {
// prepare the windows environment
CoInitialize(NULL);
std::unique_lock<std::mutex> lock(_deviceMutex, std::defer_lock);
// if disabled, clean up active clients
if (!_enablePeakValues) {
activeClients.clear();
if (lock.try_lock()) {
// deferred, if timer callbacks overlap
activeClients.clear();
}
return;
}
// lock the devices so the _inputDevices list is static
std::unique_lock<std::mutex> lock(_deviceMutex);
lock.lock();
HRESULT result;
// initialize the payload