From a5424b3798337ab1c3d068088c0a3d12236d58b5 Mon Sep 17 00:00:00 2001 From: ed Date: Mon, 22 Jul 2019 14:00:49 +0100 Subject: [PATCH] Windows: Fixed a crash when releasing a specific ASIO driver --- .../juce_audio_devices/native/juce_win32_ASIO.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/modules/juce_audio_devices/native/juce_win32_ASIO.cpp b/modules/juce_audio_devices/native/juce_win32_ASIO.cpp index f1a9f475e2..810c4b0a54 100644 --- a/modules/juce_audio_devices/native/juce_win32_ASIO.cpp +++ b/modules/juce_audio_devices/native/juce_win32_ASIO.cpp @@ -1075,11 +1075,21 @@ private: } } + static bool shouldReleaseObject (const String& driverName) + { + return driverName != "Yamaha Steinberg USB ASIO"; + } + void removeCurrentDriver() { if (asioObject != nullptr) { - asioObject->Release(); + char buffer[512] = {}; + asioObject->getDriverName (buffer); + + if (shouldReleaseObject (buffer)) + asioObject->Release(); + asioObject = nullptr; } } @@ -1127,7 +1137,7 @@ private: if (asioObject == nullptr) return "No Driver"; - const bool initOk = !! asioObject->init (juce_messageWindowHandle); + auto initOk = (asioObject->init (juce_messageWindowHandle) > 0); String driverError; // Get error message if init() failed, or if it's a buggy Denon driver,