RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TObjectList.OwnsObjects Property

Allows TObjectList to free objects when they are deleted from the list or the list is destroyed.

Pascal
property OwnsObjects: Boolean;
C++
__property Boolean OwnsObjects;

OwnsObjects allows TObjectList to control the memory of its objects. If OwnsObjects is true (the default), 

calling Delete or Remove frees the deleted object in addition to removing it from the list. 

calling Clear frees all the objects in the list in addition to emptying the list. 

calling the destructor frees all the objects in the list in addition to destroying the TObjectList itself. 

assigning a new value to an index in Items frees the object that previously occupied that position in the list. 

Even if OwnsObjects is true, the Extract method can be used to remove objects from the list without freeing them. 

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!