From 4b03790eda9b456c14328b42dab6829932d6128c Mon Sep 17 00:00:00 2001 From: Silent Date: Mon, 24 Jun 2019 21:02:30 +0200 Subject: [PATCH] Core: Fixup AutoUpdateChecker::TriggerUpdate on Windows: - Properly close handles if Updater.exe process spawns successfully - Fix STARTUPINFO sizeof typo --- Source/Core/UICommon/AutoUpdate.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Source/Core/UICommon/AutoUpdate.cpp b/Source/Core/UICommon/AutoUpdate.cpp index 00256ee174..0cca98b4b2 100644 --- a/Source/Core/UICommon/AutoUpdate.cpp +++ b/Source/Core/UICommon/AutoUpdate.cpp @@ -234,12 +234,16 @@ void AutoUpdateChecker::TriggerUpdate(const AutoUpdateChecker::NewVersionInforma INFO_LOG(COMMON, "Updater command line: %s", command_line.c_str()); #ifdef _WIN32 - STARTUPINFO sinfo = {sizeof(info)}; + STARTUPINFO sinfo = {sizeof(sinfo)}; sinfo.dwFlags = STARTF_FORCEOFFFEEDBACK; // No hourglass cursor after starting the process. PROCESS_INFORMATION pinfo; - if (!CreateProcessW(UTF8ToUTF16(reloc_updater_path).c_str(), - const_cast(UTF8ToUTF16(command_line).c_str()), nullptr, nullptr, - FALSE, 0, nullptr, nullptr, &sinfo, &pinfo)) + if (CreateProcessW(UTF8ToUTF16(reloc_updater_path).c_str(), UTF8ToUTF16(command_line).data(), + nullptr, nullptr, FALSE, 0, nullptr, nullptr, &sinfo, &pinfo)) + { + CloseHandle(pinfo.hThread); + CloseHandle(pinfo.hProcess); + } + else { ERROR_LOG(COMMON, "Could not start updater process: error=%d", GetLastError()); }