Indy 9 | Content | Index | Reference

FreeAndNil
Unit: IdGlobal
Frees an object reference and replaces the reference with Nil.

    procedure FreeAndNil(var Obj);

Unit
IdGlobal
Parameters
var Obj
Object reference to be freed and Nil'd.
Description
FreeAndNil is a procedure used to free the object reference specified by Obj, and sets the object reference to the Nil value.

Use FreeAndNil to ensure that a variable is Nil after you free the object it references. Pass any variable that represents an object as the Obj parameter.

Notes
Do not pass a value for Obj if it is not an instance of TObject or a TObject descendant.

FreeAndNil is a convenience procedure provided for Delphi or C++ Builder products using a VCL version prior to VCL 5.

Created with Doc-O-Matic 2 donated to Project JEDI. Commercial license available from the Doc-O-Matic site.