Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Collection with multiple refs to the same object - Bug
Message
 
 
À
28/10/2003 12:33:35
Matthias Will
BiCON Systemtechnik GmbH
Karlsruhe, Allemagne
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00843625
Message ID:
00843735
Vues:
21
Mathais,

No bug, you still have two outstanding object refs to o2 held by the collection. An object can not destruct until all references to it are removed VFP has always worked this way.

You can going to have to tell the collection to remove the references, once you do that the form created will destroy and the global memvar will release.

>DEFINE CLASS _Form AS Form
> PROTECTED PROCEDURE Init AS VOID
> PUBLIC gbIamHere
> DODEFAULT()
> ENDPROC
> PROTECTED PROCEDURE Destroy AS VOID
> Release gbIamHere
> DODEFAULT()
> ENDPROC
>ENDDEFINE
>
>Now do this :
>
>o = CREATEOBJECT('Collection')
>o2 = CREATEOBJECT('_Form')
>SET STEP ON * now we see the gbIamHere var in debug-window
>o.Add(o2,'First')
>o.Add(o2,'Second')
>
>o2.Release()
>SET STEP ON * -> o2 = .NULL.;o.Count = 0 this should be so, BUT gbIamHere is still visible -> Destroy has not fired -> internal dangling object-reference
>
>Because I wanted a collection to save same references with different keys this is really annoying !
>We should call this a bug, shouldn't we ?
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform