Ignore:
Timestamp:
Sep 7, 2012, 6:45:53 AM (12 years ago)
Author:
chronos
Message:
  • Upraveno: Aktualizace balíčku TemplateGenerics na novější verzi. Se starou nešel projekt správně přeložit.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/TemplateGenerics/Generic/GenericListObject.inc

    r84 r90  
    1313  // TGListObject<TListObjectIndex, TListObjectItem> = class(TGList)
    1414  TGListObject = class(TGList)
    15   private
     15  protected
    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;
    24     constructor Create;
     24    constructor Create; override;
    2525    destructor Destroy; override;
    2626  end;
     
    7575procedure TGListObject.Put(Index: TGListIndex; const AValue: TGListItem);
    7676begin
    77   if OwnsObjects then FItems[Index].Free;
     77  if OwnsObjects and (FItems[Index] <> AValue) then FItems[Index].Free;
    7878  inherited Put(Index, AValue);
    7979end;
     
    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.