Skip to content
Permalink
Browse files

UpdaterCommon: Remove manual UI::Stop() calls in favour of a scope gu…

…ard to ensure it's called on all return paths
  • Loading branch information...
CookiePLMonster committed Jun 24, 2019
1 parent 2ae409b commit 3f1ba830e7718be59fe7a597b80764af6f083c79
Showing with 2 additions and 3 deletions.
  1. +2 −3 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<Manifest> ParseManifest(const std::string& manifest)
@@ -686,6 +686,7 @@ bool RunUpdater(std::vector<std::string> 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<std::string> args)
UI::LaunchApplication(opts.binary_to_restart.value());
}

UI::Stop();

return true;
}

0 comments on commit 3f1ba83

Please sign in to comment.
You can’t perform that action at this time.