Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dereferencing/releasing an object
Message
From
28/11/2001 11:27:10
 
 
To
27/11/2001 20:36:07
Spencer Redfield
Managed Healthcare Northwest, Inc.
Portland, Oregon, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00586488
Message ID:
00587017
Views:
38
>My need/interest here is simply that I want to be sure that certain object references are properly released and so I am explicitly releasing them.
>
>I find to remove object loParameters.SearchOptions, rather than the RELEASE command, the syntax I need to use is:
>
>	loParameters.RemoveObject( "SearchOptions" )
>
>(The TO clause was not the culprit here.)

True. This seems to imply that loParameters is a container (which custom classes are) and that SearchOptions is contained in it, in which case I'm not sure I see a need to remove or release SearchOptions, as it will be released when loParameters is.

>Remaining question: I am still unclear regarding the following scenario:
>
>	oObj = NewObject( "Custom" )
>	oObj.NewObject( "oChildObj", "Custom" )
>
>Given the above, would oObj.oChildObj be correctly released by simply assigning .NULL. to oObj? Do you happen to have insight here?

That should work, though it's not what I would prefer as a coding practice. What I do (thanks to Doug Hennig) is add a Release() method to all of my base classes if they don't have one already, with the single command "RELEASE This" in it. That way, for all objects, I can just code MyObject.Release() and it should consistently work.
David M. Stowell
Ravenslake Consulting
Chicago, Illinois

e-mail: davidstowell@ravenslakeconsulting.com
Previous
Reply
Map
View

Click here to load this message in the networking platform