Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Objects in a collection - destroy() doesn't fire
Message
From
24/04/2007 05:24:22
 
 
To
18/04/2007 16:24:39
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01217484
Message ID:
01219216
Views:
10
>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
>

this is useless

>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:
>
>
	
° this is useless °°
FOR EACH oitem IN this.octls
>		oitem.oparent=null
>		oItem=null
>	ENDFOR
°°°°°°°°°°°°°°°°°°°°
° this has to be enough °°
>	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?

Check if others refereces keep the object alive
Previous
Reply
Map
View

Click here to load this message in the networking platform