Location: Symbol Reference > Classes > TJwSecurityDescriptor Class > TJwSecurityDescriptor Properties > TJwSecurityDescriptor.Owner Property
JWSCL Documentation
ContentsIndexHome
PreviousUpNext
TJwSecurityDescriptor.Owner Property
Pascal
property Owner: TJwSecurityId;

Owner sets or gets the owner of the SD. If the property OwnOwner is true and the property is set, the old Owner TJwSecurityId instance will be freed and the new owner will be copied into a new instance. So there will be two instances of this SID and the original instance is not touched and must be freed if necessary. If the property OwnOwner is false, the old Owner TJwSecurityId will not be freed and the new one will directly point to the new SID. 

The following code can be used to set a newly created instance.

   //first free or disconnect old owner
   //1. If OwnOwner is true, the Owner instance will be freed
   //2. If OwnOwner is false, the property will be set to nil
   Owner := nil;
   OwnOwner := false; //set to false so the next step does not copy the security id in a new instance
   Owner := TJwSecurityID.Create(..); //set new Sid
   OwnOwner := true; //lets free the Sid automatically

This code is equivalent:

   Owner := nil; //free or release old owner
   OwnOwner := false; //set to false so the next step does not copy the security id in a new instance
   Owner := TJwSecurityID.Create(SecurityDescriptor.Owner);
   OwnOwner := true; //lets free the Sid automatically

 

Use this code to release old owner and copy new owner into a new instance:

   Owner := nil; //free or release old owner
   OwnOwner := true; //next set copies owner
   Owner := SecurityDescriptor.Owner; //create copy of owner and set it

 

 

Use this code to use the same instance from another SD instance in both security descriptors. In this instance the owner will not be freed. You should free this instance first, before freeing the other one because if the original instance is freed you cannot access the owner because it is invalid but differs from nil. 

 

 Owner := nil; //free or release old owner
 OwnOwner := false; //do not free owner
 Owner := SecurityDescriptor.Owner; //just point to this instance
Copyright (c) 2010. All rights reserved.
This help was created by Doc-O-Matic sponsored by toolsfactory software inc.
What do you think about this topic? Send feedback!