mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-11 01:17:11 +02:00
Bug fix: Terminate worker thread before rebuilding the IDE to prevent memory leak.
git-svn-id: trunk@53591 -
This commit is contained in:
parent
3ca728a0e7
commit
f7d8ccb996
@ -118,6 +118,7 @@ type
|
||||
function Extract(const ASrcDir, ADstDir: String; var ADoOpen: Boolean; const AIsUpdate: Boolean = False): TModalResult;
|
||||
function Install(var AInstallStatus: TInstallStatus; var ANeedToRebuild: Boolean): TModalResult;
|
||||
function UpdateP(const ADstDir: String; var ADoExtract: Boolean): TModalResult;
|
||||
procedure TerminateUpdates;
|
||||
public
|
||||
end;
|
||||
|
||||
@ -156,10 +157,19 @@ begin
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure TMainFrm.TerminateUpdates;
|
||||
begin
|
||||
if Assigned(Updates) then
|
||||
begin
|
||||
Updates.StopUpdate;
|
||||
Updates.Terminate;
|
||||
Updates := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainFrm.FormDestroy(Sender: TObject);
|
||||
begin
|
||||
Updates.StopUpdate;
|
||||
Updates.Terminate;
|
||||
TerminateUpdates;
|
||||
PackageDownloader.Free;
|
||||
SerializablePackages.Free;
|
||||
VisualTree.Free;
|
||||
@ -285,6 +295,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure TMainFrm.DoOnJSONDownloadCompleted(Sender: TObject; AJSON: TJSONStringType; AErrTyp: TErrorType; const AErrMsg: String = '');
|
||||
begin
|
||||
case AErrTyp of
|
||||
@ -653,6 +664,7 @@ begin
|
||||
VisualTree.UpdatePackageStates;
|
||||
if NeedToRebuild then
|
||||
begin
|
||||
TerminateUpdates;
|
||||
EnableDisableControls(False);
|
||||
IDECommands.ExecuteIDECommand(Self, ecBuildLazarus);
|
||||
EnableDisableControls(True);
|
||||
@ -732,6 +744,7 @@ begin
|
||||
begin
|
||||
if NeedToRebuild then
|
||||
begin
|
||||
TerminateUpdates;
|
||||
EnableDisableControls(False);
|
||||
IDECommands.ExecuteIDECommand(Self, ecBuildLazarus);
|
||||
EnableDisableControls(True);
|
||||
|
Loading…
Reference in New Issue
Block a user