Add COM initializition to Windows template (#54881)

Plugins, and the library, should be able to use COM without special
setup. This adds COM initialization to the runner template so that it's
available for any code on the main thread.
This commit is contained in:
stuartmorgan 2020-04-15 14:32:39 -07:00 committed by GitHub
parent 4acc2183d9
commit 0ece276ecb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,6 +16,9 @@ int APIENTRY wWinMain(_In_ HINSTANCE instance,
::AllocConsole();
}
// Initialize COM, so that it is available for use in the library and/or plugins.
::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
RunLoop run_loop;
flutter::DartProject project(L"data");
@ -29,5 +32,6 @@ int APIENTRY wWinMain(_In_ HINSTANCE instance,
run_loop.Run();
::CoUninitialize();
return EXIT_SUCCESS;
}