[Windows] Initialize COM as apartment-threaded.

This commit is contained in:
bruvzg 2023-07-20 12:14:16 +03:00
parent 0c2144da90
commit 4bfb820d32
3 changed files with 8 additions and 3 deletions

View File

@ -706,7 +706,7 @@ void AudioDriverWASAPI::write_sample(WORD format_tag, int bits_per_sample, BYTE
}
void AudioDriverWASAPI::thread_func(void *p_udata) {
CoInitializeEx(nullptr, COINIT_MULTITHREADED);
CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
AudioDriverWASAPI *ad = static_cast<AudioDriverWASAPI *>(p_udata);
uint32_t avail_frames = 0;

View File

@ -277,7 +277,12 @@ Error DisplayServerWindows::file_dialog_show(const String &p_title, const String
pfd->SetFileTypes(filters.size(), filters.ptr());
pfd->SetFileTypeIndex(0);
hr = pfd->Show(nullptr);
WindowID window_id = _get_focused_window_or_popup();
if (!windows.has(window_id)) {
window_id = MAIN_WINDOW_ID;
}
hr = pfd->Show(windows[window_id].hWnd);
if (SUCCEEDED(hr)) {
Vector<String> file_names;

View File

@ -1714,7 +1714,7 @@ String OS_Windows::get_system_ca_certificates() {
OS_Windows::OS_Windows(HINSTANCE _hInstance) {
hInstance = _hInstance;
CoInitializeEx(nullptr, COINIT_MULTITHREADED);
CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
#ifdef WASAPI_ENABLED
AudioDriverManager::add_driver(&driver_wasapi);