Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Bug? Dangling object reference with FOR EACH
Message
From
13/11/2000 18:16:47
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Bug? Dangling object reference with FOR EACH
Miscellaneous
Thread ID:
00441354
Message ID:
00441354
Views:
54
Create a base class form, set it to use a provate datasession, put a command button on it, and put this code in the click event:

lcXML = ""
loXML = CREATEOBJECT("Microsoft.XMLDOM")
loXML.LoadXML(lcXML)
loChildren = loXML.DocumentElement.ChildNodes

FOR EACH loChild IN loChildren
ENDFOR

Run the form, click the button, and close the form. Observe in the Datasession window that you have a new 'unknown' and empty datasession. Getting rid of the FOR EACH loop corrects the problem. Explicitly releasing loChild and /or loChildren, or declaring one or both of them as local variables makes no difference.

I get the same behavior in VFP 6 SP3 and VFP 7 Miami release.
Erik Moore
Clientelligence
Next
Reply
Map
View

Click here to load this message in the networking platform