Skip to content

Improve object handling #1

@fernand-o

Description

@fernand-o

This behaviour is the same of TArray<T>, but maybe there could be a way of solving this.

When using with classes, e.g. TBetterArray<TObject>, the internal list keeps a wrong reference of the objects even after they are destroyed:

var
  Objects: TBetterArray<TObject>;
  Obj1: TObject;
begin
  Obj1 := TObject.Create;
  Objects := [Obj1];
  FreeAndNil(Obj1);
  CheckFalse(Assigned(Obj1));       // ok
  CheckFalse(Assigned(Objects[0])); // error: should be false, but returns true
end;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions