Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Another effect of the BUG on no Assign a obj reference
Message
From
23/04/2004 11:05:20
 
 
To
23/04/2004 10:20:08
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00897267
Message ID:
00897618
Views:
34
You have understood now. Optimal.

This bug could essre useful in order to make of the strange things much with VFP.

Next example it is much more instructive and interesting:
clear
X=CREATEOBJECT('myClass')
Y1=CREATEOBJECT('test')
Y1.Name = 'ImY1'
Y2=CREATEOBJECT('test')
Y2.Name = 'ImY2'
&& with next line, VFP implement a reference for Y1, 
&& but you set a reference to Y2

X.AllCallMe = m.Y1 && whit this, VFP implement a reference for Y1, 
                   && but you set a reference to Y2 without change the Y2 RefCount
? X.AllCallMe.Name && 
* Y2 refCountMutex is 2, Y2 referenceList is empty, on VFP exists 2 reference
Y2 = .NULL.  && this not call AllCallMe with .NULL. and not destroy Y2

? X.AllCallMe.Name && Y2 it still live
* Y2 refCountMutex is 1, Y1 referenceList have AllCallMe, on VFP exists 1 reference
? 'now destroy Y1 and Y2'
Y1 = .NULL.  && this call AllCallMe with .NULL.
? 'end'

DEFINE CLASS myClass AS Custom

   AllCallMe = .F.

   PROCEDURE AllCallMe_Assign(myValue)
   		? 'assign :',m.myValue
        this.AllCallMe = m.Y2
   ENDPROC
ENDDEFINE

DEFINE CLASS test AS Custom

   PROCEDURE Destroy
   		? 'destroy',this.Name
   ENDPROC
ENDDEFINE
Previous
Reply
Map
View

Click here to load this message in the networking platform