Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Question on releasing object and setting to .NULL.
Message
De
14/05/2009 18:44:36
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01399978
Message ID:
01399998
Vues:
52
Thanks David, I'm surprised I haven't created a func like this too. I like using type() over vartype() because sometimes the main object may not exist either and I hate to think harder than I have to about all possible scenarios.

Sergey, thanks, I wasn't aware that vartype() returned "X". Now my second question, is it necessary to set o.o1=.NULL. in my example anyway, since it's already null due to executing o.o1.release()? Seems there's no hanging reference in this case. Thanks again!
-Mark

>Mark,
>
>I use a UDF IsObject() to perform the test:
>
>
>lparameter roObject
>
>return( ( type( "m.roObject" ) == 'O' ) and ( ! isnull( m.roObject ) ) )
>
>
>Setting an object reference to .null. has always felt like the cleaner way to clear out the pointer to an object. Sometimes you need to know if it ever was assigned to an object. Assigning .f. and causing it to change datatypes isn't quite as good IMO.
>
>>Standard practice seems to be, to set an object's property to .NULL. after releasing an object tied to a property. For example:
>>
>>o=CREATEOBJECT("empty")
>>ADDPROPERTY(o, "o1", CREATEOBJECT("form"))
>>o.o1.release()
>>o.o1=.null.
>>? TYPE("o.o1")  && still shows "O"
>>
>>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform