Вы забыли создавать и уничтожать
Obj
Код:
WorldObjects = class
private
Flist: array of Obj;
procedure SetCount(Value: Integer);
function GetCount: Integer;
function GetList(Index: Integer): Obj;
public
constructor create;
destructor Destroy(); override;
property Count: Integer read GetCount write SetCount;
procedure AddLine(stp, enp: coords);
property List[Index: Integer]: Obj read GetList;
end;
implementation
constructor WorldObjects.Create;
begin // это не обязательно
// SetLength(List, 0);
// Count := 0;
end;
function WorldObjects.GetCount: Integer;
begin
Result := Length(FList);
end;
procedure WorldObjects.SetCount(Value: Integer);
var
oldCount, i: Integer;
begin
oldCount := Count;
for i := oldCount downto Value do
Flist[i].Free;
SetLength(Flist, Value);
for i := oldCount to Value - 1 do
Flist[i] := Obj.Create();
end;
//...
procedure WorldObjects.AddLine(stp, enp: coords);
var
nextObj: Obj;
begin
nextObj := list[count]; // смотри GetList - создастся следующий Obj
nextObj.name := 2;
nextObj.lin.stp := stp;
nextObj.lin.enp := enp;
end;
function WorldObjects.GetList(Index: Integer): Obj;
begin
if Index >= Count then
Count := Index + 1;
Result := FList[Index];
end;
destructor WorldObjects.Destroy;
begin
Count := 0; // уничтожаем все Obj
inherited;
end;