mirror of
https://github.com/lubosz/overte.git
synced 2025-04-17 00:57:44 +02:00
Fix crash when closing the Audio menu. On some machines, checkPeakValues takes long enough that timer callbacks overlap and activeClients gets clobbered while in use.
This commit is contained in:
parent
16bb992d8d
commit
91b7acec1f
1 changed files with 7 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue