norgepaul / TChromeTabs

Comprehensive Delphi implementation of Chrome's tab system
Other
218 stars 78 forks source link

ChromeTabsThreadTimer has a range check error #12

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The return value of `timeGetTime` is DWORD. So cast it as Integer might cause a 
range check error.

Here is the patch:

procedure TTimerThread.Execute;
var
  SleepTime: Integer;
  Last: DWORD;
begin
  while (FTimer.Continue) and (not Terminated) do
  begin
    Last := timeGetTime;

    try
      Synchronize(DoExecute);
    except
      // Just in case
    end;

    SleepTime := FTimer.FInterval - Integer(timeGetTime - Last);

    if SleepTime < 10 then
      SleepTime := 10;

    Sleep(SleepTime);
  end;
end;

Original issue reported on code.google.com by sx.a...@googlemail.com on 7 Apr 2014 at 4:47

GoogleCodeExporter commented 9 years ago
Resolved in r57

Original comment by sx.a...@googlemail.com on 15 May 2014 at 5:31