Nope, FreeAndNil() frees the object and then nil's the reference you passed
to it so that any other clean up code that uses Assigned() to test the same
reference won't free the object a second time.

Guy

------------
>From sysutils:

procedure FreeAndNil(var Obj);
var
  P: TObject;
begin
  P := TObject(Obj);
  TObject(Obj) := nil;  // clear the reference before destroying the object
  P.Free;
end;

--------------

-----Original Message-----
From: Andreas Toth [mailto:[EMAIL PROTECTED]

There's no need to use Assigned() since FreeAndNil() performs a similar
test...


-Andreas

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Behalf Of Peter Speden
Try

If Assigned (includelist) then
        FreeAndNil (includelist);

Etc

Or

If includelist <> nil then
        FreeAndNil (includelist);

They are not freed elsewhere are they.

Peter Speden
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to