Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Creating Object skips Thisform.Release()
Message
 
 
À
11/06/2003 20:47:07
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
00798705
Message ID:
00799202
Vues:
54
Bill,

oX = createobject( "custom" ) && object instantiates, object.referencecount set to 1
oY = oX && make another reference to the object, object.referencecount increments to 2
oX.Destroy() && doesn't do diddly squat, calling destroy event doesn't do anything
oY.Destroy() && still doesn't do anything
oX = .null. && remove a reference, object.referencecount decrements to 1, object still in memory
oY = .null. && remove the last reference, object.referencecount decrements to 0, Destroy event fires, object disappears from memory

>In the example above, oHost is being set to .null. in the Control.Destroy(), which implies that the Control is not being destroyed until AFTER the Destroy() method.

Yes, you are setting it to null, the problem is Destroy doesn't fire, because the reference counter hasn't got zero yet so your code hasn't yet been called. Destroy is the very last thing run by the object, it's intended to be a place you can hook to do any additional cleanup your object needs, like closing any tables it opened.

>Why isn't the form refusing to be destroyed, since the control still has a reference to an object at that point? The form shouldn't be able to be destroyed until after the control has released oHost.

The form is in a limbo state, it's not really gone from memory, your object reference to it might be cleared to null, but the form is still in memory, the form won't finish destructing until the button destructs.

Have you tried that code I posted? Do you see how it was resolving the deadly embrace situation?
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform