Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
I doubt this one is by design
Message
From
09/09/1999 16:49:30
 
 
To
09/09/1999 12:38:10
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00262975
Message ID:
00263146
Views:
23
>Consider the following class definitions:
>
>
>DEFINE CLASS Tester AS Custom
>	PROCEDURE RunTest
>		LOCAL oDummy
>
>		oDummy = CREATEOBJECT("wwIPSTuff")
>		WITH oDummy
>			RETURN .F.
>		ENDWITH
>	ENDPROC
>ENDDEFINE
>
>DEFINE CLASS Dummy AS Custom
>	PROCEDURE Destroy
>		x = 1
>	ENDPROC
>ENDDEFINE
>
>
>Now test with the following-
>otester = CREATEOBJECT("tester")
>?oTester.RunTest()
>
>Even though Runtest explicitly returns .F., the results of the function are .T.. this took me a long time to narrow down, but I found that the code that makes the difference is the WITH/ENDWITH.
>
>Apparently, when a local object is referenced with a WITH/ENDWITH, and the routine exits, the code in the destroy method of the referenced object "erases" the ruturn value of the routine, replacing it with the default, .T..
>
>To reproduce this 3 things have to be true:
>You have to create an object that is referenced only with a local or private varibale,
>That object must be referenced internally by VFP when the routine finishes, thereby releasing the variable and the object AND the object must have code in its Destroy event.
>
>I wanted to get some input here before submitting this as a bug.
Wait a minute.. where do you instantiate the dummy class? Is there something I am missing?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform