output/wasapi: release the COMWorker if OpenDevice() fails
Fixes assertion failure in the Thread destructor.
This commit is contained in:
		| @@ -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(); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Max Kellermann
					Max Kellermann