summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graemeg@laptop.(none)>2010-07-22 13:56:01 +0200
committerGraeme Geldenhuys <graemeg@laptop.(none)>2010-07-22 13:56:01 +0200
commiteac6236f6c74a2972222798b059c3c4f383a1b6a (patch)
tree31b5e9fbcd62d473f039f2fc2aa03cc622542f8e
parent2aa6a7083e0047d9f0043fceed03c79476cebd75 (diff)
downloadfpGUI-eac6236f6c74a2972222798b059c3c4f383a1b6a.tar.xz
ListView: Fixed memory leak in ListView.Items handling.
-rw-r--r--src/gui/fpg_listview.pas10
1 files changed, 5 insertions, 5 deletions
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