- Timestamp:
- Sep 7, 2012, 6:45:53 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/TemplateGenerics/Generic/GenericListObject.inc
r84 r90 13 13 // TGListObject<TListObjectIndex, TListObjectItem> = class(TGList) 14 14 TGListObject = class(TGList) 15 pr ivate15 protected 16 16 procedure Put(Index: TGListIndex; const AValue: TGListItem); override; 17 procedure SetCount(const AValue: TGListIndex); override; 17 18 public 18 19 OwnsObjects: Boolean; … … 20 21 function InsertNew(Index: TGListIndex; NewObject: TGListItem = nil): TGListItem; 21 22 procedure Delete(Index: TGListObjectIndex); override; 22 procedure Clear; override;23 23 procedure Assign(Source: TGList); override; 24 constructor Create; 24 constructor Create; override; 25 25 destructor Destroy; override; 26 26 end; … … 75 75 procedure TGListObject.Put(Index: TGListIndex; const AValue: TGListItem); 76 76 begin 77 if OwnsObjects then FItems[Index].Free;77 if OwnsObjects and (FItems[Index] <> AValue) then FItems[Index].Free; 78 78 inherited Put(Index, AValue); 79 79 end; … … 85 85 end; 86 86 87 procedure TGListObject. Clear;87 procedure TGListObject.SetCount(const AValue: TGListIndex); 88 88 var 89 89 I: TGListObjectIndex; 90 90 begin 91 91 if OwnsObjects then begin 92 I := 0;93 while I < Countdo begin92 I := FCount - 1; 93 while I >= AValue do begin 94 94 FItems[I].Free; 95 I := I +1;95 I := I - 1; 96 96 end; 97 97 end; 98 inherited Clear;98 inherited; 99 99 end; 100 100
Note:
See TracChangeset
for help on using the changeset viewer.