Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Weird object hierarchy bug
Message
From
24/09/2016 12:15:26
 
 
To
21/09/2016 14:30:13
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2003
Database:
MS SQL Server
Miscellaneous
Thread ID:
01641189
Message ID:
01641304
Views:
54
>I wrote a simple class, based on custom, which uses a few properties (tag, text) to return a properly formatted html or xml tag. Now these things being a hierarchy of tags, I also added children, so when it returns xml, it does it by embedding the xml from children before the closing tag. It also has a collection of attributes, which are added inside the opening tag. The whole thing, when called, requires just
>
>lcOutput=oXml.xml
>
>and the rest is handled by the recursive calls to xml_access of each member, traversing the structure treewise.
>
>Now the bug: in some cases, the children's xml would contain only the last row. Unfortunately, I fixed this before I could decide whether the other children returned anything but an empty string, or were they gone. This happened on some workstations for a couple of clients (i.e. out of three clients running this, one never reported a problem, one had a problem sometimes on a couple of workstaions and the third had it on about 40% but then it was tested no maybe a dozen of them). This usually happened on laptops (one user had it every time on the laptop, never on desktop).
>
>First I added children into a collection; then, trying to fix it, went to an array property, no change, the bug stayed. I.e. both "for each oItem in this.kids foxobject" and "for ii=1 to this.nkids... oItem=this.aKids[ii]" had the same problem.
>
>What fixed it was the changed order of operation. The part which didn't work (on some workstations) was that I created the lower-rung object and added it to a collection (or later array) property of the parent object, then went on and did more things with this child object, in some cases adding children to it (perhaps up to four levels deep). The way which now works is to create it as an object, do whatever I need to do with it, and then, when I'm done building it and its children, add it to its parent object. So create-add-change was buggy, create-change-add was not.
>
>I could post the code, if anyone's interested, it's not too long (specially if I remove a few non-essential features). I'm not posting it now because I think it's irrelevant; the question I have is whether anyone had this kind of bug, where object members referenced in a collection or array property of another object (of the same class, but not necessarily so) would vanish if they were themselves get manipulated (specially if they were becoming parent objects themselves - even though I had a situation when the bug occurred without that).
>
>Anyone seen a beast of such description?

I have one application that uses a pretty large hierarchy of objects and collections (can be 10s of thousands of objects in some cases) and never ran into anything like you're describing.

Tamar
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform