Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Objects in a collection - destroy() doesn't fire
Message
De
18/04/2007 16:24:39
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Titre:
Objects in a collection - destroy() doesn't fire
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01217484
Message ID:
01217484
Vues:
71
I have a custom object with a collection object added via Add Object. This collection contains a bunch of other custom objects, created via NewObject() function.

At some point, I needed a reference to the top level object from some of the objects in the collection. I passed it as a parameter and stored in a custom property. To clean up, in the destroy() of these custom object I have a

this.oParent=null

but it seems that the destroy never fires. I've set breakpoints at various places. I've even tried to loop through the collection, like this:
	FOR EACH oitem IN this.octls
		oitem.oparent=null
		oItem=null
	ENDFOR
	this.RemoveObject("oCtls")
but it doesn't seem to change anything - the form where this all happens won't release if any of the item objects have ever set the .oParent to the master object. If I don't visit the code where it's set, everything's fine.

Should I just add these as children of the master object, i.e. via this.newobject(), and just store a reference to them in the collection? I do need the collection so I can find the object when needed - they are created ad hoc and there can be an arbitrary number of them.

Or is there another cause why my references keep dangling?

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform