Changeset 381


Ignore:
Timestamp:
Jun 29, 2012, 7:12:23 AM (12 years ago)
Author:
chronos
Message:
  • Fixed: Memory leak on TemplateGenerics TListObject items Count changed to lower value.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Generics/TemplateGenerics/Generic/GenericListObject.inc

    r325 r381  
    1515  private
    1616    procedure Put(Index: TGListIndex; const AValue: TGListItem); override;
     17    procedure SetCount(const AValue: TGListIndex); override;
    1718  public
    1819    OwnsObjects: Boolean;
     
    2021    function InsertNew(Index: TGListIndex; NewObject: TGListItem = nil): TGListItem;
    2122    procedure Delete(Index: TGListObjectIndex); override;
    22     procedure Clear; override;
    2323    procedure Assign(Source: TGList); override;
    2424    constructor Create; override;
     
    8585end;
    8686
    87 procedure TGListObject.Clear;
     87procedure TGListObject.SetCount(const AValue: TGListIndex);
    8888var
    8989  I: TGListObjectIndex;
    9090begin
    9191  if OwnsObjects then begin
    92     I := 0;
    93     while I < Count do begin
     92    I := FCount - 1;
     93    while I >= AValue do begin
    9494      FItems[I].Free;
    95       I := I + 1;
     95      I := I - 1;
    9696    end;
    9797  end;
    98   inherited Clear;
     98  inherited;
    9999end;
    100100
Note: See TracChangeset for help on using the changeset viewer.