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

>The form is being destroyed and as a consequence of that the Form.Destroy() is executing.
>But in reality the form hasn't really finished being destroyed, so none of the controls are destroyed, and none of the control Destroy()s are ever executed.

I imagine that all of the other controls have destroyed, it's just the button that hasn't and that alone is enough to hold up the form destruct.

>Ok, one last thing.
>Do you see a difference between these two concepts, that would make one work but the other doesn't?
>Why isn't the first example (used in ALL the _base.vcx classes) a deadly embrace also?
>
>this works
>form.control.method()
>  this.oHost = thisform
>endproc
>form.control.destroy()
>  this.oHost = .null.
>endproc
>
This is a one directional link, the contained object is holding an object reference to it's form, it is cleaning up that reference during it's destroy. This is part of the garbage in the FFC IMHO. The control simply doesn't need oHost, it can much more easily just use thisform in any place it'd be using this.oHost.

>
>this doesn't
>form.control.method()
>  lo = newobject('anything')
>  lo.oCreator = this
>  this.addproperty('oSomething',lo)
>endproc
>form.control.destroy()
>  this.oSomething = .null.
>endproc
>
>anything.destroy()
>  this.oCreator = .null.
>endproc
>
You've established a bi-directional link between the two controls. A refers to B and B refers to A. Neither A's nor B's Destroy can fire because of the outstanding object ref that the other object is holding. Remember Destroy() is an event notification, it happens when all the references to an object have been removed. To successfully break the links you need the code I already posted.
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