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

View File

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

View File

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