diff --git a/Source/Core/UpdaterCommon/UpdaterCommon.cpp b/Source/Core/UpdaterCommon/UpdaterCommon.cpp index 01c5149501..89a963609c 100644 --- a/Source/Core/UpdaterCommon/UpdaterCommon.cpp +++ b/Source/Core/UpdaterCommon/UpdaterCommon.cpp @@ -16,6 +16,7 @@ #include "Common/CommonPaths.h" #include "Common/FileUtil.h" #include "Common/HttpRequest.h" +#include "Common/ScopeGuard.h" #include "Common/StringUtil.h" #include "UpdaterCommon/UI.h" @@ -498,7 +499,6 @@ void FatalError(const std::string& message) UI::SetVisible(true); UI::Error(message); - UI::Stop(); } std::optional ParseManifest(const std::string& manifest) @@ -686,6 +686,7 @@ bool RunUpdater(std::vector args) UI::Init(); UI::SetVisible(false); + Common::ScopeGuard ui_guard{[] { UI::Stop(); }}; Options opts = std::move(*maybe_opts); if (opts.log_file) @@ -777,7 +778,5 @@ bool RunUpdater(std::vector args) UI::LaunchApplication(opts.binary_to_restart.value()); } - UI::Stop(); - return true; }