Mega Code Archive

 
Categories / Delphi / Examples
 

About setting pointers to nil after freeing memory

If an object has a published field of the same name as the owned object, Delphi automatically sets that field to nil. In no other case will Delphi automatically set any field or variable to nil when freeing the referenced object. The most common situation where this arises is for components you drop on a form. Each component has a published field whose name is the component's name.