Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
YAQ on dangling reference
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01539685
Message ID:
01539735
Vues:
47
>>Hi,
>>
>>I am sorry for bringing up this topic again but I need to clarify something.
>>
>>Say a Form A calls a Form B and passes to the form B the value of itself (THISFORM). In the INIT method of Form B the value of the passed THISFORM (or Form A) is assigned to the form property FormB_ReferenceFormA. So now the Form B property FormB_ReferenceFormA hold the value referencing the form A.
>>
>>Then if somewhere in the form Form B the code sets the value of FormB_ReferenceFormA to NULL, does it actually release Form A? TIA.
>
>As long as any reference to form A exists then FormA will exists. If the property of formB is the only reference to formA then NULLing the property will destroy the form. When there is a dependency like this it is important to ensure that the "go away" code in FormA takes care of destroying FormB if it exists. That way FormA cleans up its own mess on trying to go away and no other code that wants FormA to go away needs to know anything about FormA's dependency on FormB.

Thank you for the explanation. My code does pretty much what you have described above. As I mentioned to Gregory, I had another (which turn out to be unrelated) issue but I confused it with not cleaning up correctly this mess (good choice of words on your part <g>).
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform