diff --git a/laf b/laf index 7af127f47..e2055386f 160000 --- a/laf +++ b/laf @@ -1 +1 @@ -Subproject commit 7af127f4785ac0fb0e50fa32e68e572719477f2a +Subproject commit e2055386fb2c786594afbc1c978471498e9cdf8f diff --git a/src/main/main.cpp b/src/main/main.cpp index cb2c74ae1..5bc9fb0dc 100644 --- a/src/main/main.cpp +++ b/src/main/main.cpp @@ -23,6 +23,10 @@ #include "os/system.h" #include "ver/info.h" +#if LAF_WINDOWS + #include "base/win/coinit.h" +#endif + #if ENABLE_SENTRY #include "app/sentry_wrapper.h" #if LAF_WINDOWS @@ -55,22 +59,6 @@ namespace { #endif }; -#if LAF_WINDOWS - // Successful calls to CoInitialize() (S_OK or S_FALSE) must match - // the calls to CoUninitialize(). - // From: https://docs.microsoft.com/en-us/windows/win32/api/combaseapi/nf-combaseapi-couninitialize#remarks - struct CoInit { - HRESULT hr; - CoInit() { - hr = CoInitialize(nullptr); - } - ~CoInit() { - if (hr == S_OK || hr == S_FALSE) - CoUninitialize(); - } - }; -#endif // LAF_WINDOWS - #if USE_SENTRY_BREADCRUMB_FOR_WINTAB // Delegate to write Wintab information as a Sentry breadcrumb (to // know if there is a specific Wintab driver giving problems) @@ -110,7 +98,7 @@ int app_main(int argc, char* argv[]) std::srand(static_cast(std::time(nullptr))); #if LAF_WINDOWS - CoInit com; // To create COM objects + base::CoInit com; // To create COM objects #endif // Main thread name