Browse Source

Windows: Fixed a crash when releasing a specific ASIO driver

tags/2021-05-28
ed 6 years ago
parent
commit
a5424b3798
1 changed files with 12 additions and 2 deletions
  1. +12
    -2
      modules/juce_audio_devices/native/juce_win32_ASIO.cpp

+ 12
- 2
modules/juce_audio_devices/native/juce_win32_ASIO.cpp View File

@@ -1075,11 +1075,21 @@ private:
} }
} }
static bool shouldReleaseObject (const String& driverName)
{
return driverName != "Yamaha Steinberg USB ASIO";
}
void removeCurrentDriver() void removeCurrentDriver()
{ {
if (asioObject != nullptr) if (asioObject != nullptr)
{ {
asioObject->Release();
char buffer[512] = {};
asioObject->getDriverName (buffer);
if (shouldReleaseObject (buffer))
asioObject->Release();
asioObject = nullptr; asioObject = nullptr;
} }
} }
@@ -1127,7 +1137,7 @@ private:
if (asioObject == nullptr) if (asioObject == nullptr)
return "No Driver"; return "No Driver";
const bool initOk = !! asioObject->init (juce_messageWindowHandle);
auto initOk = (asioObject->init (juce_messageWindowHandle) > 0);
String driverError; String driverError;
// Get error message if init() failed, or if it's a buggy Denon driver, // Get error message if init() failed, or if it's a buggy Denon driver,


Loading…
Cancel
Save