OpkMan: Increase TThreadTimer delay as workaround to prevent memory leaks. The other changes did not affect leaks.

git-svn-id: trunk@59381 -
This commit is contained in:
juha 2018-10-29 12:10:00 +00:00
parent b5d3a2e2ab
commit e5df044216
3 changed files with 9 additions and 6 deletions

View File

@ -343,7 +343,8 @@ begin
end;
if Assigned(FTimer) and FTimer.Enabled then
FTimer.StopTimer;
Synchronize(@DoOnJSONDownloadCompleted);
if not FNeedToBreak then
Synchronize(@DoOnJSONDownloadCompleted);
end
else if FDownloadType = dtPackage then //download from repository
begin
@ -505,6 +506,7 @@ begin
if FTimer.Enabled then
FTimer.StopTimer;
FTimer.Terminate;
FTimer.WaitFor;
end;
FHTTPClient.Free;
FMS.Free;
@ -517,7 +519,7 @@ begin
FRemoteJSONFile := Options.RemoteRepository[Options.ActiveRepositoryIndex] + cRemoteJSONFile;
FDownloadType := dtJSON;
FSilent := ASilent;
if (Assigned(LazarusIDE) and LazarusIDE.IDEStarted and (not LazarusIDE.IDEIsClosing)) then
if Assigned(LazarusIDE) and LazarusIDE.IDEStarted and not LazarusIDE.IDEIsClosing then
begin
FTimer := TThreadTimer.Create;
FTimer.Interval := ATimeOut;
@ -543,7 +545,7 @@ begin
FTotSize := FTotSize + SerializablePackages.Items[I].RepositoryFileSize;
end;
end;
if (Assigned(LazarusIDE) and LazarusIDE.IDEStarted and (not LazarusIDE.IDEIsClosing)) then
if Assigned(LazarusIDE) and LazarusIDE.IDEStarted and not LazarusIDE.IDEIsClosing then
begin
FTimer := TThreadTimer.Create;
FTimer.OnTimer := @DoOnTimer;

View File

@ -220,6 +220,7 @@ begin
begin
Updates.StopUpdate;
Updates.Terminate;
Updates.WaitFor;
Updates := nil;
end;
end;

View File

@ -59,7 +59,7 @@ constructor TThreadTimer.Create;
begin
inherited Create(True);
FreeOnTerminate := True;
FInterval := 1000;
FInterval := 10000;
FEnabled := False;
end;
@ -79,8 +79,8 @@ procedure TThreadTimer.Execute;
begin
while not Terminated do
begin
Sleep(100);
if (GetTickCount64 - FTime > FInterval) and (FEnabled) then
Sleep(1000);
if (GetTickCount64 - FTime > FInterval) and FEnabled and not Terminated then
begin
FTime := GetTickCount64;
DoOnTimer;