Skip to content

Commit d3fdaf1

Browse files
committed
Terminate the updater's progress bar thread when starting the launcher (fixes unnecessarily cpu usage while idle)
1 parent a43ef46 commit d3fdaf1

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

self_updater/self_updater.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,10 @@ void Updater::ProgressBarThread(POINT windowPos) {
373373
}
374374

375375
const UpdaterState currentState = GetCurrentUpdaterState();
376-
if (currentState != state) {
376+
if (currentState == UpdaterState::UPDATER_RUNNING_LAUNCHER || currentState == UpdaterState::UPDATER_SHUTTING_DOWN) {
377+
// Progress bar no longer needed. Allow the thread to terminate.
378+
break;
379+
} else if (currentState != state) {
377380
state = currentState;
378381

379382
if (UpdaterStateProgressBarLabels.find(state) != UpdaterStateProgressBarLabels.end()) {
@@ -396,7 +399,7 @@ void Updater::ProgressBarThread(POINT windowPos) {
396399
}
397400
}
398401

399-
Logger::Error("Progress bar thread ended.\n");
402+
Logger::Info("Progress bar thread ended.\n");
400403
}
401404

402405
Updater::UpdateLauncherResult Updater::TryUpdateLauncher(int argc, char** argv, HWND mainWindow) {

0 commit comments

Comments
 (0)