Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
I doubt this one is by design
Message
De
09/09/1999 17:13:55
 
 
À
09/09/1999 16:49:30
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00262975
Message ID:
00263157
Vues:
25
>>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?

No, I missed something. I forgot to change back some stuff in my sample code. wwIPStuff is the class I found the error with. Just change out wwIPStuff with "Dummy" for the sample to work as posted. Sorry.
Erik Moore
Clientelligence
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform