Commit 8b41c4f3 authored by Max Kellermann's avatar Max Kellermann

output/wasapi: release the COMWorker if OpenDevice() fails

Fixes assertion failure in the Thread destructor.
parent 17f7098e
...@@ -205,7 +205,13 @@ public: ...@@ -205,7 +205,13 @@ public:
WasapiOutput(const ConfigBlock &block); WasapiOutput(const ConfigBlock &block);
void Enable() override { void Enable() override {
COMWorker::Aquire(); COMWorker::Aquire();
try {
COMWorker::Async([&]() { OpenDevice(); }).get(); COMWorker::Async([&]() { OpenDevice(); }).get();
} catch (...) {
COMWorker::Release();
throw;
}
} }
void Disable() noexcept override { void Disable() noexcept override {
COMWorker::Async([&]() { DoDisable(); }).get(); COMWorker::Async([&]() { DoDisable(); }).get();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment