mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 16:36:33 +00:00
[RAPPS] reduce the chance assert failed
This commit is contained in:
parent
4c524ee3d5
commit
c5e111427c
1 changed files with 15 additions and 1 deletions
|
@ -149,6 +149,7 @@ public:
|
|||
UINT uiPercentage = ((ULONGLONG) ulProgress * 100) / ulProgressMax;
|
||||
|
||||
/* send the current progress to the progress bar */
|
||||
if (!IsWindow()) return;
|
||||
SendMessage(PBM_SETPOS, uiPercentage, 0);
|
||||
|
||||
/* format total download size */
|
||||
|
@ -163,6 +164,7 @@ public:
|
|||
else
|
||||
{
|
||||
/* send the current progress to the progress bar */
|
||||
if (!IsWindow()) return;
|
||||
SendMessage(PBM_SETPOS, 0, 0);
|
||||
|
||||
/* total size is not known, display only current size */
|
||||
|
@ -170,6 +172,7 @@ public:
|
|||
}
|
||||
|
||||
/* and finally display it */
|
||||
if (!IsWindow()) return;
|
||||
SendMessage(WM_SETTEXT, 0, (LPARAM) ProgressText.GetString());
|
||||
}
|
||||
|
||||
|
@ -492,8 +495,10 @@ VOID CDownloadManager::UpdateProgress(
|
|||
{
|
||||
HWND Item;
|
||||
|
||||
if (!IsWindow(hDlg)) return;
|
||||
ProgressBar.SetProgress(ulProgress, ulProgressMax);
|
||||
|
||||
if (!IsWindow(hDlg)) return;
|
||||
Item = GetDlgItem(hDlg, IDC_DOWNLOAD_STATUS);
|
||||
if (Item && szStatusText && wcslen(szStatusText) > 0 && UrlHasBeenCopied == FALSE)
|
||||
{
|
||||
|
@ -580,6 +585,7 @@ unsigned int WINAPI CDownloadManager::ThreadFunc(LPVOID param)
|
|||
for (iAppId = 0; iAppId < InfoArray.GetSize(); ++iAppId)
|
||||
{
|
||||
// Reset progress bar
|
||||
if (!IsWindow(hDlg)) break;
|
||||
Item = GetDlgItem(hDlg, IDC_DOWNLOAD_PROGRESS);
|
||||
if (Item)
|
||||
{
|
||||
|
@ -616,7 +622,7 @@ unsigned int WINAPI CDownloadManager::ThreadFunc(LPVOID param)
|
|||
break;
|
||||
}
|
||||
|
||||
|
||||
if (!IsWindow(hDlg)) goto end;
|
||||
SetWindowTextW(hDlg, szNewCaption.GetString());
|
||||
|
||||
// build the path for the download
|
||||
|
@ -671,6 +677,7 @@ unsigned int WINAPI CDownloadManager::ThreadFunc(LPVOID param)
|
|||
}
|
||||
|
||||
// Add the download URL
|
||||
if (!IsWindow(hDlg)) goto end;
|
||||
SetDlgItemTextW(hDlg, IDC_DOWNLOAD_STATUS, InfoArray[iAppId].szUrl.GetString());
|
||||
|
||||
DownloadsListView.SetDownloadStatus(iAppId, DLSTATUS_DOWNLOADING);
|
||||
|
@ -832,6 +839,7 @@ unsigned int WINAPI CDownloadManager::ThreadFunc(LPVOID param)
|
|||
}
|
||||
|
||||
dwCurrentBytesRead += dwBytesRead;
|
||||
if (!IsWindow(hDlg)) goto end;
|
||||
UpdateProgress(hDlg, dwCurrentBytesRead, dwContentLen, 0, InfoArray[iAppId].szUrl.GetString());
|
||||
} while (dwBytesRead && !bCancelled);
|
||||
|
||||
|
@ -850,6 +858,7 @@ unsigned int WINAPI CDownloadManager::ThreadFunc(LPVOID param)
|
|||
ProgressBar.SetMarquee(FALSE);
|
||||
|
||||
dwContentLen = dwCurrentBytesRead;
|
||||
if (!IsWindow(hDlg)) goto end;
|
||||
UpdateProgress(hDlg, dwCurrentBytesRead, dwContentLen, 0, InfoArray[iAppId].szUrl.GetString());
|
||||
}
|
||||
|
||||
|
@ -866,6 +875,7 @@ unsigned int WINAPI CDownloadManager::ThreadFunc(LPVOID param)
|
|||
goto end;
|
||||
}
|
||||
|
||||
if (!IsWindow(hDlg)) goto end;
|
||||
SetWindowTextW(hDlg, szMsgText.GetString());
|
||||
SendMessageW(GetDlgItem(hDlg, IDC_DOWNLOAD_STATUS), WM_SETTEXT, 0, (LPARAM) Path.GetString());
|
||||
|
||||
|
@ -878,6 +888,7 @@ unsigned int WINAPI CDownloadManager::ThreadFunc(LPVOID param)
|
|||
goto end;
|
||||
}
|
||||
|
||||
if (!IsWindow(hDlg)) goto end;
|
||||
MessageBoxW(hDlg, szMsgText.GetString(), NULL, MB_OK | MB_ICONERROR);
|
||||
goto end;
|
||||
}
|
||||
|
@ -902,6 +913,7 @@ run:
|
|||
//reflect installation progress in the titlebar
|
||||
//TODO: make a separate string with a placeholder to include app name?
|
||||
ATL::CStringW szMsgText = LoadStatusString(DLSTATUS_INSTALLING);
|
||||
if (!IsWindow(hDlg)) goto end;
|
||||
SetWindowTextW(hDlg, szMsgText.GetString());
|
||||
|
||||
DownloadsListView.SetDownloadStatus(iAppId, DLSTATUS_INSTALLING);
|
||||
|
@ -929,10 +941,12 @@ end:
|
|||
DeleteFileW(Path.GetString());
|
||||
}
|
||||
|
||||
if (!IsWindow(hDlg)) return 0;
|
||||
DownloadsListView.SetDownloadStatus(iAppId, DLSTATUS_FINISHED);
|
||||
}
|
||||
|
||||
delete static_cast<DownloadParam*>(param);
|
||||
if (!IsWindow(hDlg)) return 0;
|
||||
SendMessageW(hDlg, WM_CLOSE, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue