1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Windows: Fixed a potential crash when closing and re-opening WASAPI audio devices

This commit is contained in:
ed 2020-02-13 16:47:14 +00:00
parent 9fda031414
commit 0ff16ddadb

View file

@ -1244,14 +1244,14 @@ public:
while (! threadShouldExit())
{
if (outputDevice != nullptr && outputDevice->shouldClose)
if ((outputDevice != nullptr && outputDevice->shouldClose)
|| (inputDevice != nullptr && inputDevice->shouldClose))
{
deviceBecameInactive = true;
}
if (inputDevice != nullptr && ! deviceBecameInactive)
{
if (inputDevice->shouldClose)
deviceBecameInactive = true;
if (outputDevice == nullptr)
{
if (WaitForSingleObject (inputDevice->clientEvent, 1000) == WAIT_TIMEOUT)
@ -1372,8 +1372,11 @@ private:
{
if (deviceBecameInactive)
{
deviceBecameInactive = false;
MessageManager::callAsync ([this] { reopenDevices(); });
MessageManager::callAsync ([this]
{
close();
reopenDevices();
});
}
};