Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve object handling #1

Open
fernand-o opened this issue Apr 20, 2018 · 0 comments
Open

Improve object handling #1

fernand-o opened this issue Apr 20, 2018 · 0 comments

Comments

@fernand-o
Copy link
Owner

fernand-o commented Apr 20, 2018

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;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant