Browse Source

* Patch from Luiz Americo for some cleanup (bug ID 22550)

git-svn-id: trunk@22600 -
michael 13 years ago
parent
commit
74149ab196
2 changed files with 11 additions and 9 deletions
  1. 1 1
      packages/fcl-db/src/base/db.pas
  2. 10 8
      packages/fcl-db/src/base/fields.inc

+ 1 - 1
packages/fcl-db/src/base/db.pas

@@ -1067,7 +1067,7 @@ type
   Tfields = Class(TObject)
     Private
       FDataset : TDataset;
-      FFieldList : TList;
+      FFieldList : TFpList;
       FOnChange : TNotifyEvent;
       FValidFieldKinds : TFieldKinds;
     Protected

+ 10 - 8
packages/fcl-db/src/base/fields.inc

@@ -3135,14 +3135,14 @@ Constructor TFields.Create(ADataset : TDataset);
 
 begin
   FDataSet:=ADataset;
-  FFieldList:=TList.Create;
+  FFieldList:=TFpList.Create;
   FValidFieldKinds:=[fkData..fkInternalcalc];
 end;
 
 Destructor TFields.Destroy;
 
 begin
-  if FFieldList <> nil then Clear;
+  Clear;
   FFieldList.Free;
   inherited Destroy;
 end;
@@ -3235,13 +3235,15 @@ begin
 end;
 
 Procedure TFields.Clear;
-
+var
+  AField: TField;
 begin
-  with FFieldList do
-    while Count > 0 do begin
-      TField(Last).FDataSet := Nil;
-      TField(Last).Free;
-      FFieldList.Delete(Count - 1);
+  while FFieldList.Count > 0 do 
+    begin
+    AField := TField(FFieldList.Last);
+    AField.FDataSet := Nil;
+    AField.Free;
+    FFieldList.Delete(FFieldList.Count - 1);
     end;
   Changed;
 end;