diff --git a/src/updater/win32_main.cpp b/src/updater/win32_main.cpp index ebe2e694a..d39e7b613 100644 --- a/src/updater/win32_main.cpp +++ b/src/updater/win32_main.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2019-2023 Connor McLaughlin +// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin // SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0) #include "updater.h" @@ -7,9 +7,11 @@ #include "common/file_system.h" #include "common/log.h" #include "common/path.h" +#include "common/scoped_guard.h" #include "common/string_util.h" #include "common/windows_headers.h" +#include #include static void WaitForProcessToExit(int process_id) @@ -26,6 +28,12 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLi { Win32ProgressCallback progress; + const bool com_initialized = CoInitializeEx(nullptr, COINIT_MULTITHREADED); + const ScopedGuard com_guard = [com_initialized]() { + if (com_initialized) + CoUninitialize(); + }; + int argc = 0; LPWSTR* argv = CommandLineToArgvW(lpCmdLine, &argc); if (!argv || argc <= 0)