diff --git a/drivers/wasapi/audio_driver_wasapi.cpp b/drivers/wasapi/audio_driver_wasapi.cpp index eeeb6ee689e..6c84aee2b72 100644 --- a/drivers/wasapi/audio_driver_wasapi.cpp +++ b/drivers/wasapi/audio_driver_wasapi.cpp @@ -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(p_udata); uint32_t avail_frames = 0; diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp index 73e0ec65116..435917e471b 100644 --- a/platform/windows/display_server_windows.cpp +++ b/platform/windows/display_server_windows.cpp @@ -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 file_names; diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index df93631ef05..7c94e38e14e 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -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);