fix a leak

This commit is contained in:
Basile Burg 2016-11-04 15:55:21 +01:00
parent e1cba9ae37
commit bd4941dedb
No known key found for this signature in database
GPG Key ID: 1868039F415CB8CF
1 changed files with 6 additions and 5 deletions

View File

@ -230,12 +230,12 @@ type
// allow to retrieve the breakpoints even if source is not openened. // allow to retrieve the breakpoints even if source is not openened.
TPersistentBreakPoints = class(TWritableLfmTextComponent) TPersistentBreakPoints = class(TWritableLfmTextComponent)
strict private strict private
fItems: TOwnedCollection; fItems: TCollection;
procedure setItems(value: TOwnedCollection); procedure setItems(value: TCollection);
function getItem(index: integer): TPersistentBreakPoint; function getItem(index: integer): TPersistentBreakPoint;
function find(const fname: string; line: integer; kind: TBreakPointKind): boolean; function find(const fname: string; line: integer; kind: TBreakPointKind): boolean;
published published
property items: TOwnedCollection read fItems write setItems; property items: TCollection read fItems write setItems;
public public
constructor create(aOwner: TComponent); override; constructor create(aOwner: TComponent); override;
destructor destroy; override; destructor destroy; override;
@ -637,7 +637,7 @@ var
fname: string; fname: string;
begin begin
Inherited; Inherited;
fItems := TOwnedCollection.Create(self, TPersistentBreakPoint); fItems := TCollection.Create(TPersistentBreakPoint);
fname := getCoeditDocPath + bpFname; fname := getCoeditDocPath + bpFname;
if fname.fileExists then if fname.fileExists then
loadFromFile(fname); loadFromFile(fname);
@ -647,10 +647,11 @@ destructor TPersistentBreakPoints.destroy;
begin begin
if fItems.Count > 0 then if fItems.Count > 0 then
saveToFile(getCoeditDocPath + bpFname); saveToFile(getCoeditDocPath + bpFname);
fItems.Free;
inherited; inherited;
end; end;
procedure TPersistentBreakPoints.setItems(value: TOwnedCollection); procedure TPersistentBreakPoints.setItems(value: TCollection);
begin begin
fItems.Assign(value); fItems.Assign(value);
end; end;