From 7147b1dbba652f7dfc0c316fe72aa6f5f6bd4fcb Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Tue, 10 May 2011 22:45:07 +0000 Subject: [PATCH] Check only for visibility of member form in updater, so hidden dialogs are counted as successfully closed. Fixes issue #2217. --- res/updater/updater.dpr | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/res/updater/updater.dpr b/res/updater/updater.dpr index ba9d50b4..09c19ceb 100644 --- a/res/updater/updater.dpr +++ b/res/updater/updater.dpr @@ -18,7 +18,6 @@ const WindowWidth = 600; WindowHeight = 80; QuitTimeout = 20000; // We long we're gracefully waiting for a window to be gone, in milliseconds - ClosePostInterval = 2000; // Interval between WM_CLOSE posts to a window, in milliseconds TerminatedCheck = 200; // Interval between checks if host application is gone PathDelim = '\'; @@ -158,16 +157,16 @@ begin Hint := 'Closing "'+WndTitle+'"'; Status(Hint); WaitTime := 0; + PostMessage(Wnd, WM_CLOSE, 0, 0); while WaitTime < QuitTimeout do begin - if WaitTime mod ClosePostInterval = 0 then - PostMessage(Wnd, WM_CLOSE, 0, 0); Sleep(TerminatedCheck); Inc(WaitTime, TerminatedCheck); Status(Hint + ', wait time left: '+IntToStr((QuitTimeout - WaitTime) div 1000)+' seconds.'); - if not IsWindow(Wnd) then + // IsWindow() returns true on dialogs we have just hidden + if not IsWindowVisible(Wnd) then break; end; - if IsWindow(Wnd) then begin + if IsWindowVisible(Wnd) then begin Status('Error: Could not terminate session '+WndTitle, true); Result := False; end;