
Check for potential AV, usage after .Free, .DisposeOf or := nil
Just thought that this could be possibly quite easy to check (At least the Trivial cases)
Sometimes you tinker the code but just do not see the access to the Class instance after the line. Or sometimes you reorder code for some other reason and does not see. Or we code Monkeys are sometimes just blind and stupid :D
Problem would be to analyze the False positives. But even catching trivial cases would be helpful.
begin
...
LS.Free;
LS.Add('Funk'); // Error/Warning of access Freed object
...
end;
begin
..
LS := nil;
...
if Assigned(LS) or (LS <> nil) then
LS.Add('Rock')
else
LS.Add('This Rocks Also');
...
LS.Add('Funk You!'); // Error/Warning of access Freed object
end;
But Detecting all is very hard because class could be passed as Var parameter etc and returned Freed and possibly nil, but worse case is the it is freed but not set to nil, if used before that particular call.
Have bumbed errors like this sometimes, that there are Object passed around and there is this one magical castle of code that calls .Free;

Customer support service by UserEcho