output/wasapi: release the COMWorker if OpenDevice() fails
Fixes assertion failure in the Thread destructor.
This commit is contained in:
parent
17f7098e27
commit
8b41c4f384
|
@ -205,7 +205,13 @@ public:
|
||||||
WasapiOutput(const ConfigBlock &block);
|
WasapiOutput(const ConfigBlock &block);
|
||||||
void Enable() override {
|
void Enable() override {
|
||||||
COMWorker::Aquire();
|
COMWorker::Aquire();
|
||||||
COMWorker::Async([&]() { OpenDevice(); }).get();
|
|
||||||
|
try {
|
||||||
|
COMWorker::Async([&]() { OpenDevice(); }).get();
|
||||||
|
} catch (...) {
|
||||||
|
COMWorker::Release();
|
||||||
|
throw;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void Disable() noexcept override {
|
void Disable() noexcept override {
|
||||||
COMWorker::Async([&]() { DoDisable(); }).get();
|
COMWorker::Async([&]() { DoDisable(); }).get();
|
||||||
|
|
Loading…
Reference in New Issue