Is there a way to check if a pointer has been already disposed?
TRecTest = record
Test : string;
end;
PRecTest = ^TRecTest;
...
var
P : PRecTest;
begin
New(P);
//...
Dispose(P);
//here I want to check that P has been already disposed
end;
If I call Dipose(P)
again, an EInvalidPointer
exception with message 'Invalid pointer operation' is raised.
I know I could set it to nil
and then use Assigned
...
var
P : PRecTest;
begin
New(P);
//...
Dispose(P);
P := nil;
if(not Assigned(P))
then ShowMessage('Disposed');
end;
...but I would like to know if it's possible to check if P
is still a valid pointer without setting its value to nil.