mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-15 19:39:28 +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 Extract(const ASrcDir, ADstDir: String; var ADoOpen: Boolean; const AIsUpdate: Boolean = False): TModalResult;
|
||||||
function Install(var AInstallStatus: TInstallStatus; var ANeedToRebuild: Boolean): TModalResult;
|
function Install(var AInstallStatus: TInstallStatus; var ANeedToRebuild: Boolean): TModalResult;
|
||||||
function UpdateP(const ADstDir: String; var ADoExtract: Boolean): TModalResult;
|
function UpdateP(const ADstDir: String; var ADoExtract: Boolean): TModalResult;
|
||||||
|
procedure TerminateUpdates;
|
||||||
public
|
public
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -156,10 +157,19 @@ begin
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMainFrm.TerminateUpdates;
|
||||||
|
begin
|
||||||
|
if Assigned(Updates) then
|
||||||
|
begin
|
||||||
|
Updates.StopUpdate;
|
||||||
|
Updates.Terminate;
|
||||||
|
Updates := nil;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TMainFrm.FormDestroy(Sender: TObject);
|
procedure TMainFrm.FormDestroy(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
Updates.StopUpdate;
|
TerminateUpdates;
|
||||||
Updates.Terminate;
|
|
||||||
PackageDownloader.Free;
|
PackageDownloader.Free;
|
||||||
SerializablePackages.Free;
|
SerializablePackages.Free;
|
||||||
VisualTree.Free;
|
VisualTree.Free;
|
||||||
@ -285,6 +295,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TMainFrm.DoOnJSONDownloadCompleted(Sender: TObject; AJSON: TJSONStringType; AErrTyp: TErrorType; const AErrMsg: String = '');
|
procedure TMainFrm.DoOnJSONDownloadCompleted(Sender: TObject; AJSON: TJSONStringType; AErrTyp: TErrorType; const AErrMsg: String = '');
|
||||||
begin
|
begin
|
||||||
case AErrTyp of
|
case AErrTyp of
|
||||||
@ -653,6 +664,7 @@ begin
|
|||||||
VisualTree.UpdatePackageStates;
|
VisualTree.UpdatePackageStates;
|
||||||
if NeedToRebuild then
|
if NeedToRebuild then
|
||||||
begin
|
begin
|
||||||
|
TerminateUpdates;
|
||||||
EnableDisableControls(False);
|
EnableDisableControls(False);
|
||||||
IDECommands.ExecuteIDECommand(Self, ecBuildLazarus);
|
IDECommands.ExecuteIDECommand(Self, ecBuildLazarus);
|
||||||
EnableDisableControls(True);
|
EnableDisableControls(True);
|
||||||
@ -732,6 +744,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
if NeedToRebuild then
|
if NeedToRebuild then
|
||||||
begin
|
begin
|
||||||
|
TerminateUpdates;
|
||||||
EnableDisableControls(False);
|
EnableDisableControls(False);
|
||||||
IDECommands.ExecuteIDECommand(Self, ecBuildLazarus);
|
IDECommands.ExecuteIDECommand(Self, ecBuildLazarus);
|
||||||
EnableDisableControls(True);
|
EnableDisableControls(True);
|
||||||
|
Loading…
Reference in New Issue
Block a user