From 468bfe00d4e2aa9a3d6e1cdcce176d105b71f91f Mon Sep 17 00:00:00 2001 From: dmex Date: Mon, 16 Apr 2012 03:23:49 +0000 Subject: [PATCH] Updater: stop download if window closed/thread aborted git-svn-id: svn://svn.code.sf.net/p/processhacker/code@4987 21ef857c-d57f-4fe0-8362-d861dc6d29cd --- 2.x/trunk/plugins/Updater/updater.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/2.x/trunk/plugins/Updater/updater.c b/2.x/trunk/plugins/Updater/updater.c index bd7ad9b16..3619c9969 100644 --- a/2.x/trunk/plugins/Updater/updater.c +++ b/2.x/trunk/plugins/Updater/updater.c @@ -400,7 +400,8 @@ static NTSTATUS DownloadUpdateThreadStart( while ((nReadFile = InternetReadFile(hRequest, buffer, BUFFER_LEN, &dwBytesRead))) { - if (dwBytesRead == 0) + // If we get zero bytes or the download thread was closed. + if (dwBytesRead == 0 || !DownloadThreadHandle) break; if (!nReadFile) @@ -442,7 +443,8 @@ static NTSTATUS DownloadUpdateThreadStart( while ((nReadFile = InternetReadFile(hRequest, buffer, BUFFER_LEN, &dwBytesRead))) { - if (dwBytesRead == 0) + // If we get zero bytes or the download thread was closed. + if (dwBytesRead == 0 || !DownloadThreadHandle) break; if (!nReadFile)