Skip to content

Commit

Permalink
[misc] refactor the "operation in progress" detection
Browse files Browse the repository at this point in the history
* Remove unused iso_op_in_progress and use a single op_in_progress that gets
  set when we disable the controls.
* Also fix an issue where Ctrl-L was being processed as Alt-L due yet another
  completely backwards Windows behaviour where the message that is meant to
  indicating whether Alt is pressed is also sometimes used to indicate that
  another key is being pressed if the dialog doesn't have keyboard focus...
  • Loading branch information
pbatard committed Aug 22, 2019
1 parent af95de8 commit 21351b9
Show file tree
Hide file tree
Showing 5 changed files with 302 additions and 309 deletions.
6 changes: 2 additions & 4 deletions src/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ static DWORD WINAPI CheckForUpdatesThread(LPVOID param)
do {
for (i=0; (i<30) && (!force_update_check); i++)
Sleep(500);
} while ((!force_update_check) && ((iso_op_in_progress || format_op_in_progress || (dialog_showing>0))));
} while ((!force_update_check) && ((op_in_progress || (dialog_showing > 0))));
if (!force_update_check) {
if ((ReadSetting32(SETTING_UPDATE_INTERVAL) == -1)) {
vuprintf("Check for updates disabled, as per settings.");
Expand Down Expand Up @@ -829,7 +829,7 @@ static DWORD WINAPI CheckForUpdatesThread(LPVOID param)
// Start the new download after cleanup
if (found_new_version) {
// User may have started an operation while we were checking
while ((!force_update_check) && (iso_op_in_progress || format_op_in_progress || (dialog_showing > 0))) {
while ((!force_update_check) && (op_in_progress || (dialog_showing > 0))) {
Sleep(15000);
}
DownloadNewVersion();
Expand Down Expand Up @@ -994,7 +994,6 @@ static DWORD WINAPI DownloadISOThread(LPVOID param)
// Download the ISO and report errors if any
SendMessage(hMainDialog, UM_PROGRESS_INIT, 0, 0);
FormatStatus = 0;
format_op_in_progress = TRUE;
SendMessage(hMainDialog, UM_TIMER_START, 0, 0);
if (DownloadToFileOrBuffer(url, img_save.ImagePath, NULL, hMainDialog, TRUE) == 0) {
SendMessage(hMainDialog, UM_PROGRESS_EXIT, 0, 0);
Expand All @@ -1011,7 +1010,6 @@ static DWORD WINAPI DownloadISOThread(LPVOID param)
image_path = safe_strdup(img_save.ImagePath);
PostMessage(hMainDialog, UM_SELECT_ISO, 0, 0);
}
format_op_in_progress = FALSE;
safe_free(img_save.ImagePath);
}
}
Expand Down
Loading

0 comments on commit 21351b9

Please sign in to comment.