Closed hrydgard closed 5 years ago
Thanks for finding this! I had the same issue. I changed the relevant lines in nfd_win.cpp to:
if (autoCoInit.Result() != RPC_E_CHANGED_MODE
&& !SUCCEEDED(autoCoInit.Result()))
{
....
so that it won't bail out if that specific error is returned from the CoInitializeEx
Fix in master branch. Version bumped to 1.1.5.
On Windows, in NFD_OpenDialog, COM is initialized like this:
Unfortunately, if COM has already been initialized in the process through COINIT_MULTITHREADED, the above call will fail (but COM will still work). See https://docs.microsoft.com/en-us/windows/win32/api/combaseapi/nf-combaseapi-coinitializeex.
And if the above call fails, NFD_OpenFileDialog just bails. This breaks our application.
I can think of three solutions:
We use this library through https://github.com/saurvs/nfd-rs , but this is easily reproducible by adding a a
CoInitializeEx(NULL, COINIT_MULTITHREADED);
call to main() in test_opendialog.c.