Hello everyone,
I plan to write a method similar to Delphi7 freeandnil procedure, but for
TAutoObject in Delphi 5 version.
Here is the prototype code.
procedure STTAutoObjectRelease(var aAutoObject: TAutoObject);
var
varAutoObject: TAutoObject;
begin
varAutoObject := aAutoObject;
if varAutoObject = nil then
begin
Exit;
end;
TObject(aAutoObject) := nil; // clear the reference before destroying the
object
varAutoObject.release;
end;
But the issue is I worried about TAutoObject will be like interface, every
time pass between method, auto increment, decrement reference counting. That
make this method to complex to decide.
The normal way to do is like here.
if assigned(fAutoObject) then
begin
fAutoObject.Release;
end;
But that is three lines code.
Here is what I proposed to do.
STTAutoObjectRelease(fAutoObject);
TIA
Regards
Leigh
http://www.salenz.com
_______________________________________________
Delphi mailing list
[email protected]
http://ns3.123.co.nz/mailman/listinfo/delphi