Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Question on releasing object and setting to .NULL.
Message
 
 
To
14/05/2009 18:44:36
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01399978
Message ID:
01400013
Views:
63
Mark,

> Now my second question, is it necessary to set o.o1=.NULL. in my example anyway, since it's already null due to executing o.o1.release()? Seems there's no hanging reference in this case. Thanks again!

This really depends on your object design, if it requires a specific call to a method to allow it to clean up after itself or not. I typically never call Release(). I normally put cleanup code in Destroy() and just null out the reference and let it clean itself up on it's way out. Sometimes I'll call a special Destruct() or CleanUp() method if the object has more complex things to do or if it has to report back a success or failure in it's clean up.

I'd say 99.9% of my object use code follows this pattern:
ox = createobject( ... )
...
ox.DoSomething()
...
ox = .null.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Reply
Map
View

Click here to load this message in the networking platform