From eac6236f6c74a2972222798b059c3c4f383a1b6a Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Thu, 22 Jul 2010 13:56:01 +0200 Subject: ListView: Fixed memory leak in ListView.Items handling. --- src/gui/fpg_listview.pas | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/gui') diff --git a/src/gui/fpg_listview.pas b/src/gui/fpg_listview.pas index e07af511..e55c74d7 100644 --- a/src/gui/fpg_listview.pas +++ b/src/gui/fpg_listview.pas @@ -122,7 +122,7 @@ type FColumns: TfpgLVColumns; FCurrentIndexOf: Integer; FViewers: TList; - FItems: TList; + FItems: TObjectList; function GetCapacity: Integer; function GetItem(AIndex: Integer): TfpgLVItem; procedure SetCapacity(const AValue: Integer); @@ -390,7 +390,7 @@ end; constructor TfpgLVItems.Create(AViewer: IfpgLVItemViewer); begin - FItems := TList.Create; + FItems := TObjectList.Create; FViewers := TList.Create; AddViewer(AViewer); end; @@ -436,11 +436,11 @@ begin // search significantly when we are using indexof in a for loop if (FCurrentIndexOf > 100) and (FCurrentIndexOf < Count-2) then begin - if FItems.Items[FCurrentIndexOf] = Pointer(AItem) then + if FItems.Items[FCurrentIndexOf] = AItem then Result := FCurrentIndexOf - else if FItems.Items[FCurrentIndexOf+1] = Pointer(AItem) then + else if FItems.Items[FCurrentIndexOf+1] = AItem then Result := FCurrentIndexOf+1 - else if FItems.Items[FCurrentIndexOf-1] = Pointer(AItem) then + else if FItems.Items[FCurrentIndexOf-1] = AItem then Result := FCurrentIndexOf-1 end; if Result = -1 then -- cgit v1.2.3-70-g09d2