Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
BUG: return a new object by reference fire a C5 crash
Message
De
12/04/2004 06:09:41
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
BUG: return a new object by reference fire a C5 crash
Divers
Thread ID:
00893984
Message ID:
00893984
Vues:
57
If you try to return a object by reference, many things can happen.

Next Fire a C5 crash:
LOCAL oReference
	WITH CREATEOBJECT("RootObject")
		.ReturnAnObject(@m.oReference)
*		? m.oReference.myReference.Class
	ENDWITH

DEFINE CLASS RootObject as Custom

	FUNCTION ReturnAnObject(oObjectRef as Object) as Object
		oObjectRef = CREATEOBJECT("subObject")
		oObjectRef.myReference = m.This           && line C5
	ENDFUNC
	
ENDDEFINE 

DEFINE CLASS subObject as Custom

	myReference = .NULL.

ENDDEFINE
but with these workaround C5 is not fired:
LOCAL oReference
	WITH CREATEOBJECT("RootObject")
		.ReturnAnObject(@m.oReference)
*		? m.oReference.myReference.Class
	ENDWITH

DEFINE CLASS RootObject as Custom

	FUNCTION ReturnAnObject(oObjectRef as Object) as Object
		oObjectRef = CREATEOBJECT("subObject")
                dummy      = m.This
		oObjectRef.myReference = m.dummy
	ENDFUNC
	
ENDDEFINE 

DEFINE CLASS subObject as Custom

	myReference = .NULL.

ENDDEFINE
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform