Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Possible WISH LIST item?
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00149579
Message ID:
00149895
Views:
26
>Nope. Actually there are two commands in VFP that don't take care about the internal reference counter, one is RELEASE THIS, the other THIS.RemoveObject().

Didn't know that... Are you sure? Reason I ask I've had major problems
with hanging references in the past and nothing I tried at the time would
release the object short of explicitly going through all the child
references.

>>Doing RELEASE THIS is also not safe, because you're telling the object to
>>release itself before state is cleaned up.
>
>Somehow I don't grasp this. If RELEASE THIS is in my Release method and I call loObject.Release I tell the object to release itself, since I don't need it anymore. Why shouldn't that be safe?

Because code may run after you do RELEASE THIS. If you have subclassed
the Destroy of the subclass may run in addition to yours. There may be
code following the RELEASE THIS, which in reality shouldn't be accessible
any longer, but in Fox it does. RELEASE doesn't fire any events explicitly
except in a form - so you can't really capture that it's happening.

If you want a good idea try it in C++ by calling the destructor directly
from within a class method <s>...

>>I firmly believe that you should never release your object internally,
>>at least not through the language. Rather I belive in having Release
>>methods that make sure that when the object goes away all hanging
>>refs get cleaned up properly.
>
>That's exactly what Mark and I are talking about.

Yeah, but you're not talking about external release!
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform