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:
parent
9fda031414
commit
0ff16ddadb
1 changed files with 9 additions and 6 deletions
|
|
@ -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();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue