win32/Com: make COINIT_APARTMENTTHREADED the default constructor
This commit is contained in:
		| @@ -307,7 +307,7 @@ IAudioClient *wasapi_output_get_client(WasapiOutput &output) noexcept { | |||||||
| void WasapiOutputThread::Work() noexcept { | void WasapiOutputThread::Work() noexcept { | ||||||
| 	SetThreadName("Wasapi Output Worker"); | 	SetThreadName("Wasapi Output Worker"); | ||||||
| 	FormatDebug(wasapi_output_domain, "Working thread started"); | 	FormatDebug(wasapi_output_domain, "Working thread started"); | ||||||
| 	COM com{true}; | 	COM com; | ||||||
| 	while (true) { | 	while (true) { | ||||||
| 		try { | 		try { | ||||||
| 			event.Wait(); | 			event.Wait(); | ||||||
|   | |||||||
| @@ -28,7 +28,7 @@ | |||||||
| // https://docs.microsoft.com/en-us/windows/win32/api/_com/ | // https://docs.microsoft.com/en-us/windows/win32/api/_com/ | ||||||
| class COM { | class COM { | ||||||
| public: | public: | ||||||
| 	COM(bool) { | 	COM() { | ||||||
| 		if (HRESULT result = CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); | 		if (HRESULT result = CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); | ||||||
| 		    FAILED(result)) { | 		    FAILED(result)) { | ||||||
| 			throw MakeHResultError( | 			throw MakeHResultError( | ||||||
|   | |||||||
| @@ -25,7 +25,7 @@ void | |||||||
| COMWorker::Work() noexcept | COMWorker::Work() noexcept | ||||||
| { | { | ||||||
| 	SetThreadName("COM Worker"); | 	SetThreadName("COM Worker"); | ||||||
| 	COM com{true}; | 	COM com; | ||||||
| 	while (true) { | 	while (true) { | ||||||
| 		if (!running_flag.test_and_set()) { | 		if (!running_flag.test_and_set()) { | ||||||
| 			return; | 			return; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Max Kellermann
					Max Kellermann