mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-14 21:59:18 +02:00
IDE: configure install package dlg: fixed mem leak
git-svn-id: trunk@23048 -
This commit is contained in:
parent
3e41146e8d
commit
65daa78b02
@ -398,6 +398,7 @@ var
|
|||||||
begin
|
begin
|
||||||
for i:=0 to FNewInstalledPackages.Count-1 do
|
for i:=0 to FNewInstalledPackages.Count-1 do
|
||||||
TObject(FNewInstalledPackages[i]).Free;
|
TObject(FNewInstalledPackages[i]).Free;
|
||||||
|
FNewInstalledPackages.Clear;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TInstallPkgSetDialog.CheckSelection: boolean;
|
function TInstallPkgSetDialog.CheckSelection: boolean;
|
||||||
@ -595,9 +596,8 @@ begin
|
|||||||
LazPackageID:=TLazPackageID.Create;
|
LazPackageID:=TLazPackageID.Create;
|
||||||
end;
|
end;
|
||||||
// clean up old list
|
// clean up old list
|
||||||
for i:=0 to FNewInstalledPackages.Count-1 do
|
ClearNewInstalledPackages;
|
||||||
TObject(FNewInstalledPackages[i]).Free;
|
FNewInstalledPackages.Free;
|
||||||
FNewInstalledPackages.Clear;
|
|
||||||
// assign new list
|
// assign new list
|
||||||
FNewInstalledPackages:=NewList;
|
FNewInstalledPackages:=NewList;
|
||||||
NewList:=nil;
|
NewList:=nil;
|
||||||
@ -704,14 +704,16 @@ var
|
|||||||
OldPackageID: TLazPackageID;
|
OldPackageID: TLazPackageID;
|
||||||
APackage: TLazPackage;
|
APackage: TLazPackage;
|
||||||
Deletions: TFPList;
|
Deletions: TFPList;
|
||||||
|
DelPackageID: TLazPackageID;
|
||||||
|
j: LongInt;
|
||||||
begin
|
begin
|
||||||
OldPackageID := nil;
|
OldPackageID := nil;
|
||||||
Deletions:=TFPList.Create;
|
Deletions:=TFPList.Create;
|
||||||
try
|
try
|
||||||
for i:=0 to InstallListBox.Items.Count-1 do begin
|
for i:=0 to InstallListBox.Items.Count-1 do begin
|
||||||
|
if not InstallListBox.Selected[i] then continue;
|
||||||
if OldPackageID = nil then
|
if OldPackageID = nil then
|
||||||
OldPackageID:=TLazPackageID.Create;
|
OldPackageID:=TLazPackageID.Create;
|
||||||
if not InstallListBox.Selected[i] then continue;
|
|
||||||
if not OldPackageID.StringToID(InstallListBox.Items[i]) then begin
|
if not OldPackageID.StringToID(InstallListBox.Items[i]) then begin
|
||||||
InstallListBox.Selected[i]:=false;
|
InstallListBox.Selected[i]:=false;
|
||||||
debugln('TInstallPkgSetDialog.AddToUninstallButtonClick invalid ID: ',
|
debugln('TInstallPkgSetDialog.AddToUninstallButtonClick invalid ID: ',
|
||||||
@ -720,8 +722,10 @@ begin
|
|||||||
end;
|
end;
|
||||||
// ok => add to deletions
|
// ok => add to deletions
|
||||||
Deletions.Add(OldPackageID);
|
Deletions.Add(OldPackageID);
|
||||||
|
DelPackageID:=OldPackageID;
|
||||||
|
OldPackageID := nil;
|
||||||
// get package
|
// get package
|
||||||
APackage:=PackageGraph.FindPackageWithID(OldPackageID);
|
APackage:=PackageGraph.FindPackageWithID(DelPackageID);
|
||||||
if APackage<>nil then begin
|
if APackage<>nil then begin
|
||||||
// check if package is a base package
|
// check if package is a base package
|
||||||
if APackage.AutoCreated
|
if APackage.AutoCreated
|
||||||
@ -733,22 +737,24 @@ begin
|
|||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
OldPackageID := nil;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// ok => remove from list
|
// ok => remove from list
|
||||||
InstallListBox.ItemIndex:=-1;
|
InstallListBox.ItemIndex:=-1;
|
||||||
for i:=0 to Deletions.Count-1 do begin
|
for i:=0 to Deletions.Count-1 do begin
|
||||||
OldPackageID:=TLazPackageID(Deletions[i]);
|
DelPackageID:=TLazPackageID(Deletions[i]);
|
||||||
FNewInstalledPackages.Delete(IndexOfNewInstalledPackageID(OldPackageID));
|
j:=IndexOfNewInstalledPackageID(DelPackageID);
|
||||||
|
TObject(FNewInstalledPackages[j]).Free;
|
||||||
|
FNewInstalledPackages.Delete(j);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
UpdateNewInstalledPackages;
|
UpdateNewInstalledPackages;
|
||||||
UpdateButtonStates;
|
UpdateButtonStates;
|
||||||
finally
|
finally
|
||||||
|
OldPackageID.Free;
|
||||||
for i:=0 to Deletions.Count-1 do begin
|
for i:=0 to Deletions.Count-1 do begin
|
||||||
OldPackageID:=TLazPackageID(Deletions[i]);
|
DelPackageID:=TLazPackageID(Deletions[i]);
|
||||||
OldPackageID.Free;
|
DelPackageID.Free;
|
||||||
end;
|
end;
|
||||||
Deletions.Clear;
|
Deletions.Clear;
|
||||||
Deletions.Free;
|
Deletions.Free;
|
||||||
|
Loading…
Reference in New Issue
Block a user