Permalink
Browse files

Merge pull request #7583 from delroth/updater-crash

Fix Updater crashes with new taskbar integration feature
  • Loading branch information...
delroth committed Nov 22, 2018
2 parents 1805f51 + c9d5ac3 commit fe8854db434d850e2826a6a2ad3b2ba4052af8dd
Showing with 22 additions and 4 deletions.
  1. +22 −4 Source/Core/Updater/UI.cpp
@@ -47,7 +47,16 @@ bool Init()
if (!window_handle)
return false;
CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&taskbar_list));
if (FAILED(CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER,
IID_PPV_ARGS(&taskbar_list))))
{
taskbar_list = nullptr;
}
if (taskbar_list && FAILED(taskbar_list->HrInit()))
{
taskbar_list->Release();
taskbar_list = nullptr;
}
label_handle = CreateWindow(L"STATIC", NULL, WS_VISIBLE | WS_CHILD, 5, 5, 500, 25, window_handle,
nullptr, nullptr, 0);
@@ -93,7 +102,10 @@ void SetTotalMarquee(bool marquee)
SetWindowLong(total_progressbar_handle, GWL_STYLE,
PROGRESSBAR_FLAGS | (marquee ? PBS_MARQUEE : 0));
SendMessage(total_progressbar_handle, PBM_SETMARQUEE, marquee, 0);
taskbar_list->SetProgressState(window_handle, marquee ? TBPF_INDETERMINATE : TBPF_NORMAL);
if (taskbar_list)
{
taskbar_list->SetProgressState(window_handle, marquee ? TBPF_INDETERMINATE : TBPF_NORMAL);
}
}
void ResetTotalProgress()
@@ -106,7 +118,10 @@ void SetTotalProgress(int current, int total)
{
SendMessage(total_progressbar_handle, PBM_SETRANGE32, 0, total);
SendMessage(total_progressbar_handle, PBM_SETPOS, current, 0);
taskbar_list->SetProgressValue(window_handle, current, total);
if (taskbar_list)
{
taskbar_list->SetProgressValue(window_handle, current, total);
}
}
void SetCurrentMarquee(bool marquee)
@@ -130,7 +145,10 @@ void Error(const std::string& text)
(L"A fatal error occured and the updater cannot continue:\n " + wide_text).c_str(),
L"Error", MB_ICONERROR);
taskbar_list->SetProgressState(window_handle, TBPF_ERROR);
if (taskbar_list)
{
taskbar_list->SetProgressState(window_handle, TBPF_ERROR);
}
}
void SetCurrentProgress(int current, int total)

0 comments on commit fe8854d

Please sign in to comment.