Is there a pratical reason why FreeAndNil
sets the reference to nil
before freeing the object?
procedure FreeAndNil(var Obj);
var
Temp: TObject;
begin
Temp := TObject(Obj);
Pointer(Obj) := nil;
Temp.Free;
end;
Based on the name of the function, I was expecting something like this:
procedure FreeAndNil(var Obj);
begin
TObject(Obj).Free;
Pointer(Obj) := nil;
end;